The TaskMID field of sturtc Mpi2SCSITaskManagementRequest_t seems to be a 16-bits little endian value but is not declared as such, causing sparse to generate warnings. Change this field declaration to __le16 and fix a test in _ctl_set_task_mid() to avoid sparse warnings. Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> --- drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index 8f1b903fe0a9..80bcf7d83184 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -428,7 +428,7 @@ typedef struct _MPI2_SCSI_TASK_MANAGE_REQUEST { U16 Reserved3; /*0x0A */ U8 LUN[8]; /*0x0C */ U32 Reserved4[7]; /*0x14 */ - U16 TaskMID; /*0x30 */ + __le16 TaskMID; /*0x30 */ U16 Reserved5; /*0x32 */ } MPI2_SCSI_TASK_MANAGE_REQUEST, *PTR_MPI2_SCSI_TASK_MANAGE_REQUEST, diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index d92ca140d298..eac253fce2da 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c @@ -618,7 +618,8 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, * first outstanding smid will be picked up. Otherwise, * targeted smid will be the one. */ - if (!tm_request->TaskMID || tm_request->TaskMID == st->smid) { + if (!tm_request->TaskMID || + tm_request->TaskMID == cpu_to_le16(st->smid)) { tm_request->TaskMID = cpu_to_le16(st->smid); found = 1; } -- 2.35.1