All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: remove an unnecessary NULL check
@ 2018-08-23 13:56 Dan Carpenter
  2018-08-30 11:34 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-08-23 13:56 UTC (permalink / raw)
  To: kernel-janitors

Smatch complains about this code:

    drivers/scsi/lpfc/lpfc_scsi.c:1053 lpfc_get_scsi_buf_s4()
    warn: variable dereferenced before check 'lpfc_cmd' (see line 1039)

Fortunately the NULL check isn't required so I have removed it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 5c7858e735c9..ef20d37e44db 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1050,7 +1050,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
 	if (!found)
 		return NULL;
 
-	if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
+	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
 		atomic_inc(&ndlp->cmd_pending);
 		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
 	}

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

* Re: [PATCH] scsi: lpfc: remove an unnecessary NULL check
  2018-08-23 13:56 [PATCH] scsi: lpfc: remove an unnecessary NULL check Dan Carpenter
@ 2018-08-30 11:34 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2018-08-30 11:34 UTC (permalink / raw)
  To: kernel-janitors


Dan,

> Smatch complains about this code:
>
>     drivers/scsi/lpfc/lpfc_scsi.c:1053 lpfc_get_scsi_buf_s4()
>     warn: variable dereferenced before check 'lpfc_cmd' (see line 1039)
>
> Fortunately the NULL check isn't required so I have removed it.

Applied to 4.20/scsi-queue, thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2018-08-30 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 13:56 [PATCH] scsi: lpfc: remove an unnecessary NULL check Dan Carpenter
2018-08-30 11:34 ` 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.