diff options
author | Sreekanth Reddy <sreekanth.reddy@broadcom.com> | 2021-06-29 16:11:53 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-29 22:39:15 +0200 |
commit | 62e528b80d6b5753e03f005e4858eefb7a84f877 (patch) | |
tree | 98651fc803e03700a620eddb49419f30622e5a24 /drivers/scsi/mpi3mr/mpi3mr_os.c | |
parent | scsi: qedf: Add check to synchronize abort and flush (diff) | |
download | linux-62e528b80d6b5753e03f005e4858eefb7a84f877.tar.xz linux-62e528b80d6b5753e03f005e4858eefb7a84f877.zip |
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>
Diffstat (limited to 'drivers/scsi/mpi3mr/mpi3mr_os.c')
-rw-r--r-- | drivers/scsi/mpi3mr/mpi3mr_os.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 40676155e62d..24ac7ddec749 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -867,8 +867,9 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, if ((dev_info & MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_MASK) != MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_NVME_DEVICE) tgtdev->is_hidden = 1; - if (mrioc->shost) - prot_mask = scsi_host_get_prot(mrioc->shost); + if (!mrioc->shost) + break; + prot_mask = scsi_host_get_prot(mrioc->shost); if (prot_mask & SHOST_DIX_TYPE0_PROTECTION) { scsi_host_set_prot(mrioc->shost, prot_mask & 0x77); ioc_info(mrioc, |