Skip to content

Commit 62e528b

Browse files
sreekanthbrcmmartinkpetersen
authored andcommitted
scsi: mpi3mr: Fix warnings reported by smatch
Fix the following warning reported by static analysis tool smatch: smatch warnings: drivers/scsi/mpi3mr/mpi3mr_os.c:873 mpi3mr_update_tgtdev() error: we previously assumed 'mrioc->shost' could be null (see line 870 Link: https://lore.kernel.org/r/20210629141153.3158-1-sreekanth.reddy@broadcom.com Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent df99446 commit 62e528b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,9 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc,
867867
if ((dev_info & MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_MASK) !=
868868
MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_NVME_DEVICE)
869869
tgtdev->is_hidden = 1;
870-
if (mrioc->shost)
871-
prot_mask = scsi_host_get_prot(mrioc->shost);
870+
if (!mrioc->shost)
871+
break;
872+
prot_mask = scsi_host_get_prot(mrioc->shost);
872873
if (prot_mask & SHOST_DIX_TYPE0_PROTECTION) {
873874
scsi_host_set_prot(mrioc->shost, prot_mask & 0x77);
874875
ioc_info(mrioc,

0 commit comments

Comments
 (0)