Skip to content
Commit 37126399 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin K. Petersen
Browse files

scsi: bfa: Fix function pointer type mismatch for state machines



The bfa driver is full of state machines and a generic abstraction layer
for them. This relies on casting function pointers, but that is no longer
allowed when CONFIG_CFI_CLANG is enabled and causes a huge number of
warnings like:

drivers/scsi/bfa/bfad.c:169:3: error: cast from 'void (*)(struct bfad_s *, enum bfad_sm_event)' to 'bfa_sm_t' (aka 'void (*)(void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
                bfa_sm_set_state(bfad, bfad_sm_created);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Rework the mechanism to no longer require the function pointer casts, by
having separate types for each individual state machine. This in turn
requires moving the enum definitions for each state machine into the header
files in order to define the typedef.

Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240222124433.2046570-2-arnd@kernel.org


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b6960023
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment