Skip to content

Commit 9cefd6e

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Fix incorrect big endian type assignment in bsg loopback path
The kernel test robot reported sparse warnings regarding incorrect type assignment for __be16 variables in bsg loopback path. Change the flagged lines to use the be16_to_cpu() and cpu_to_be16() macros appropriately. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20230614175944.3577-1-justintee8345@gmail.com Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202306110819.sDIKiGgg-lkp@intel.com/ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 9127169 commit 9cefd6e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
889889
struct lpfc_iocbq *piocbq)
890890
{
891891
uint32_t evt_req_id = 0;
892-
uint32_t cmd;
892+
u16 cmd;
893893
struct lpfc_dmabuf *dmabuf = NULL;
894894
struct lpfc_bsg_event *evt;
895895
struct event_data *evt_dat = NULL;
@@ -915,7 +915,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
915915

916916
ct_req = (struct lpfc_sli_ct_request *)bdeBuf1->virt;
917917
evt_req_id = ct_req->FsType;
918-
cmd = ct_req->CommandResponse.bits.CmdRsp;
918+
cmd = be16_to_cpu(ct_req->CommandResponse.bits.CmdRsp);
919919

920920
spin_lock_irqsave(&phba->ct_ev_lock, flags);
921921
list_for_each_entry(evt, &phba->ct_ev_waiters, node) {
@@ -3186,8 +3186,8 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job)
31863186
ctreq->RevisionId.bits.InId = 0;
31873187
ctreq->FsType = SLI_CT_ELX_LOOPBACK;
31883188
ctreq->FsSubType = 0;
3189-
ctreq->CommandResponse.bits.CmdRsp = ELX_LOOPBACK_DATA;
3190-
ctreq->CommandResponse.bits.Size = size;
3189+
ctreq->CommandResponse.bits.CmdRsp = cpu_to_be16(ELX_LOOPBACK_DATA);
3190+
ctreq->CommandResponse.bits.Size = cpu_to_be16(size);
31913191
segment_offset = ELX_LOOPBACK_HEADER_SZ;
31923192
} else
31933193
segment_offset = 0;

0 commit comments

Comments
 (0)