Skip to content

Commit cc74e31

Browse files
Colin Ian Kingmartinkpetersen
authored andcommitted
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>
1 parent a544523 commit cc74e31

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎drivers/scsi/lpfc/lpfc_nvmet.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
17451745
fc_hdr = (struct fc_frame_header *)(nvmebuf->hbuf.virt);
17461746
oxid = be16_to_cpu(fc_hdr->fh_ox_id);
17471747

1748-
if (!nvmebuf || !phba->targetport) {
1748+
if (!phba->targetport) {
17491749
lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
17501750
"6154 LS Drop IO x%x\n", oxid);
17511751
oxid = 0;
@@ -1770,8 +1770,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
17701770
lpfc_nvmeio_data(phba, "NVMET LS DROP: "
17711771
"xri x%x sz %d from %06x\n",
17721772
oxid, size, sid);
1773-
if (nvmebuf)
1774-
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
1773+
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
17751774
return;
17761775
}
17771776
ctxp->phba = phba;
@@ -1814,8 +1813,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
18141813
ctxp->oxid, rc);
18151814

18161815
/* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */
1817-
if (nvmebuf)
1818-
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
1816+
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
18191817

18201818
atomic_inc(&tgtp->xmt_ls_abort);
18211819
lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, sid, oxid);

0 commit comments

Comments
 (0)