All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpi3mr: Fix warnings reported by smatch
@ 2021-06-29 14:11 Sreekanth Reddy
  2021-06-29 20:39 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Sreekanth Reddy @ 2021-06-29 14:11 UTC (permalink / raw)
  To: linux-scsi, martin.petersen
  Cc: jejb, mpi3mr-linuxdrv.pdl, kashyap.desai, sathya.prakash,
	Sreekanth Reddy, kernel test robot, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

Fix below warning reported by static analysis tool
named 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

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>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
 1 file 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,
-- 
2.27.0


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mpi3mr: Fix warnings reported by smatch
  2021-06-29 14:11 [PATCH] mpi3mr: Fix warnings reported by smatch Sreekanth Reddy
@ 2021-06-29 20:39 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-06-29 20:39 UTC (permalink / raw)
  To: Sreekanth Reddy
  Cc: linux-scsi, martin.petersen, jejb, mpi3mr-linuxdrv.pdl,
	kashyap.desai, sathya.prakash, kernel test robot, Dan Carpenter


Sreekanth,

> Fix below warning reported by static analysis tool
> named smatch,

Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-29 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 14:11 [PATCH] mpi3mr: Fix warnings reported by smatch Sreekanth Reddy
2021-06-29 20:39 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.