diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-07-13 10:39:54 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-07-31 05:17:53 +0200 |
commit | cc74e31d4147f26ead6ea06e4649d63a14edc0fe (patch) | |
tree | f8a141f8315c6b63df6678120eac63f23d6a8d4c /drivers/scsi | |
parent | scsi: ibmvscsi: change strncpy+truncation to strlcpy (diff) | |
download | linux-cc74e31d4147f26ead6ea06e4649d63a14edc0fe.tar.xz linux-cc74e31d4147f26ead6ea06e4649d63a14edc0fe.zip |
scsi: lpfc: remove null check on nvmebuf
The null checks on nvmebuf are redundant as nvmebuf is always obtained from
a container_of() and hence can never be null. Remove all the redundant null
checks. This also cleans up a static analysis warning.
Detected by CoverityScan, CID#1471753 ("Dereference before null check")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nvmet.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 22f8a204b69f..b766afe10d3d 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c @@ -1745,7 +1745,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, fc_hdr = (struct fc_frame_header *)(nvmebuf->hbuf.virt); oxid = be16_to_cpu(fc_hdr->fh_ox_id); - if (!nvmebuf || !phba->targetport) { + if (!phba->targetport) { lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, "6154 LS Drop IO x%x\n", oxid); oxid = 0; @@ -1770,8 +1770,7 @@ dropit: lpfc_nvmeio_data(phba, "NVMET LS DROP: " "xri x%x sz %d from %06x\n", oxid, size, sid); - if (nvmebuf) - lpfc_in_buf_free(phba, &nvmebuf->dbuf); + lpfc_in_buf_free(phba, &nvmebuf->dbuf); return; } ctxp->phba = phba; @@ -1814,8 +1813,7 @@ dropit: ctxp->oxid, rc); /* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */ - if (nvmebuf) - lpfc_in_buf_free(phba, &nvmebuf->dbuf); + lpfc_in_buf_free(phba, &nvmebuf->dbuf); atomic_inc(&tgtp->xmt_ls_abort); lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, sid, oxid); |