* [bug report] lpfc: Refactor Send LS Abort support
@ 2020-05-12 8:46 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-05-12 8:46 UTC (permalink / raw)
To: jsmart2021; +Cc: linux-scsi
Hello James Smart,
The patch e96a22b0b7c2: "lpfc: Refactor Send LS Abort support" from
Mar 31, 2020, leads to the following static checker warning:
drivers/scsi/lpfc/lpfc_nvmet.c:1366 lpfc_nvmet_ls_abort()
warn: 'ret' can be either negative or positive
drivers/scsi/lpfc/lpfc_nvmet.c
832 /**
833 * __lpfc_nvme_ls_abort - Generic service routine to abort a prior
834 * NVME LS request
835 * @vport: The local port that issued the LS
836 * @ndlp: The remote port the LS was sent to
837 * @pnvme_lsreq: Pointer to LS request structure from the transport
838 *
839 * The driver validates the ndlp, looks for the LS, and aborts the
840 * LS if found.
841 *
842 * Returns:
843 * 0 : if LS found and aborted
844 * non-zero: various error conditions in form -Exxx
This is an unpublished Smatch check where negatives and positives are
both treated as errors. I think the code is correct. But the comment
describing the returns needs to be updated.
845 **/
846 int
847 __lpfc_nvme_ls_abort(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
848 struct nvmefc_ls_req *pnvme_lsreq)
849 {
850 struct lpfc_hba *phba = vport->phba;
851 struct lpfc_sli_ring *pring;
852 struct lpfc_iocbq *wqe, *next_wqe;
853 bool foundit = false;
854
855 if (!ndlp) {
856 lpfc_printf_log(phba, KERN_ERR,
857 LOG_NVME_DISC | LOG_NODE |
858 LOG_NVME_IOERR | LOG_NVME_ABTS,
859 "6049 NVMEx LS REQ Abort: Bad NDLP x%px DID "
860 "x%06x, Failing LS Req\n",
861 ndlp, ndlp ? ndlp->nlp_DID : 0);
862 return -EINVAL;
863 }
864
865 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC | LOG_NVME_ABTS,
866 "6040 NVMEx LS REQ Abort: Issue LS_ABORT for lsreq "
867 "x%p rqstlen:%d rsplen:%d %pad %pad\n",
868 pnvme_lsreq, pnvme_lsreq->rqstlen,
869 pnvme_lsreq->rsplen, &pnvme_lsreq->rqstdma,
870 &pnvme_lsreq->rspdma);
871
872 /*
873 * Lock the ELS ring txcmplq and look for the wqe that matches
874 * this ELS. If found, issue an abort on the wqe.
875 */
876 pring = phba->sli4_hba.nvmels_wq->pring;
877 spin_lock_irq(&phba->hbalock);
878 spin_lock(&pring->ring_lock);
879 list_for_each_entry_safe(wqe, next_wqe, &pring->txcmplq, list) {
880 if (wqe->context2 == pnvme_lsreq) {
881 wqe->iocb_flag |= LPFC_DRIVER_ABORTED;
882 foundit = true;
883 break;
884 }
885 }
886 spin_unlock(&pring->ring_lock);
887
888 if (foundit)
889 lpfc_sli_issue_abort_iotag(phba, pring, wqe);
890 spin_unlock_irq(&phba->hbalock);
891
892 if (foundit)
893 return 0;
894
895 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC | LOG_NVME_ABTS,
896 "6213 NVMEx LS REQ Abort: Unable to locate req x%p\n",
897 pnvme_lsreq);
898 return 1;
^^^^^^^^
899 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-12 8:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-12 8:46 [bug report] lpfc: Refactor Send LS Abort support Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox