Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jsmart2021@gmail.com
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] lpfc: Refactor Send LS Abort support
Date: Tue, 12 May 2020 11:46:26 +0300	[thread overview]
Message-ID: <20200512084626.GA252662@mwanda> (raw)

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

                 reply	other threads:[~2020-05-12  8:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512084626.GA252662@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jsmart2021@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox