OSDN Git Service

scsi: elx: efct: Fix void-pointer-to-enum-cast warning for efc_nport_topology
authorJames Smart <jsmart2021@gmail.com>
Mon, 30 Aug 2021 23:10:50 +0000 (16:10 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 14 Sep 2021 02:15:40 +0000 (22:15 -0400)
commit96fafe7c6523886308605d30ec92c7936abe7c2c
tree3390bd494c82d1cd15e157539a9e7694157cc9bd
parent6a2ea0d34af1ca807d5ba6a8350a037ff3cd35cc
scsi: elx: efct: Fix void-pointer-to-enum-cast warning for efc_nport_topology

The kernel test robot flagged an warning for ".../efc_device.c:932:6:
warning: cast to smaller integer type 'enum efc_nport_topology' from 'void
*'"

For the topology events, the "arg" field is generically defined as a void *
and is used to pass different arguments. Most of the arguments are pointers
to data structures. But for the EFC_EVT_NPORT_TOPOLOGY_NOTIFY event, the
argument is an enum value, and the code is typecasting the void * to an
enum generating the warning.

Fix by converting the EFC_EVT_NPORT_TOPOLOGY_NOTIFY event to pass a pointer
to the enum, thus it's a straight-forward pointer dereference in the event
handler.

Link: https://lore.kernel.org/r/20210830231050.5951-1-jsmart2021@gmail.com
Fixes: 202bfdffae27 ("scsi: elx: libefc: FC node ELS and state handling")
Reported-by: kernel test robot <lkp@intel.com>
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/elx/libefc/efc_device.c
drivers/scsi/elx/libefc/efc_fabric.c