Message ID | 20180823135633.5qcevijtcalx76u6@kili.mountain (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | scsi: lpfc: remove an unnecessary NULL check | expand |
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!
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; }
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>