Commit 7789bf05 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jens Axboe

floppy: fix function pointer cast warnings

clang-16 complains about a control flow integrity (kcfi) violation
casting between incompatible pointers:

drivers/block/floppy.c:2001:11: error: cast from 'void (*)(void)' to 'done_f' (aka 'void (*)(int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 2001 |         .done           = (done_f)empty
      |                           ^~~~~~~~~~~~~

Just add another empty function with the correct prototype as a
workaround.

The warning is for code that was added before the start of the normal
git history, but I tracked it done to an early change in the reconstructed
linux-history.git.

Fixes: 598a477a ("Import 1.1.41")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213095918.455478-1-arnd@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 921e81db
...@@ -530,14 +530,13 @@ static struct format_descr format_req; ...@@ -530,14 +530,13 @@ static struct format_descr format_req;
static char *floppy_track_buffer; static char *floppy_track_buffer;
static int max_buffer_sectors; static int max_buffer_sectors;
typedef void (*done_f)(int);
static const struct cont_t { static const struct cont_t {
void (*interrupt)(void); void (*interrupt)(void);
/* this is called after the interrupt of the /* this is called after the interrupt of the
* main command */ * main command */
void (*redo)(void); /* this is called to retry the operation */ void (*redo)(void); /* this is called to retry the operation */
void (*error)(void); /* this is called to tally an error */ void (*error)(void); /* this is called to tally an error */
done_f done; /* this is called to say if the operation has void (*done)(int); /* this is called to say if the operation has
* succeeded/failed */ * succeeded/failed */
} *cont; } *cont;
...@@ -985,6 +984,10 @@ static void empty(void) ...@@ -985,6 +984,10 @@ static void empty(void)
{ {
} }
static void empty_done(int result)
{
}
static void (*floppy_work_fn)(void); static void (*floppy_work_fn)(void);
static void floppy_work_workfn(struct work_struct *work) static void floppy_work_workfn(struct work_struct *work)
...@@ -1998,14 +2001,14 @@ static const struct cont_t wakeup_cont = { ...@@ -1998,14 +2001,14 @@ static const struct cont_t wakeup_cont = {
.interrupt = empty, .interrupt = empty,
.redo = do_wakeup, .redo = do_wakeup,
.error = empty, .error = empty,
.done = (done_f)empty .done = empty_done,
}; };
static const struct cont_t intr_cont = { static const struct cont_t intr_cont = {
.interrupt = empty, .interrupt = empty,
.redo = process_fd_request, .redo = process_fd_request,
.error = empty, .error = empty,
.done = (done_f)empty .done = empty_done,
}; };
/* schedules handler, waiting for completion. May be interrupted, will then /* schedules handler, waiting for completion. May be interrupted, will then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment