All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] scsi: ufs: Abort tasks before clearing them from doorbell
Date: Mon, 23 May 2022 10:17:57 +0300	[thread overview]
Message-ID: <Yos1JTu75ddjVYk7@kili> (raw)

[ Can Guo's email is bouncing.  Ah well.  - dan ]

Hello Can Guo,

The patch 307348f6ab14: "scsi: ufs: Abort tasks before clearing them
from doorbell" from Aug 24, 2020, leads to the following Smatch
static checker warning:

	drivers/ufs/core/ufshcd.c:7064 ufshcd_try_to_abort_task()
	warn: missing error code here? '_dev_err()' failed. 'err' = '0'

drivers/ufs/core/ufshcd.c
    7032 static int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag)
    7033 {
    7034         struct ufshcd_lrb *lrbp = &hba->lrb[tag];
    7035         int err = 0;
    7036         int poll_cnt;
    7037         u8 resp = 0xF;
    7038         u32 reg;
    7039 
    7040         for (poll_cnt = 100; poll_cnt; poll_cnt--) {
    7041                 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag,
    7042                                 UFS_QUERY_TASK, &resp);
    7043                 if (!err && resp == UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED) {
    7044                         /* cmd pending in the device */
    7045                         dev_err(hba->dev, "%s: cmd pending in the device. tag = %d\n",
    7046                                 __func__, tag);
    7047                         break;
    7048                 } else if (!err && resp == UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
    7049                         /*
    7050                          * cmd not pending in the device, check if it is
    7051                          * in transition.
    7052                          */
    7053                         dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n",
    7054                                 __func__, tag);
    7055                         reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
    7056                         if (reg & (1 << tag)) {
    7057                                 /* sleep for max. 200us to stabilize */
    7058                                 usleep_range(100, 200);
    7059                                 continue;
    7060                         }
    7061                         /* command completed already */
    7062                         dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
    7063                                 __func__, tag);

Error message printed on success path.

--> 7064                         goto out;
    7065                 } else {
    7066                         dev_err(hba->dev,
    7067                                 "%s: no response from device. tag = %d, err %d\n",
    7068                                 __func__, tag, err);
    7069                         if (!err)
    7070                                 err = resp; /* service response error */
    7071                         goto out;
    7072                 }
    7073         }
    7074 

regards,
dan carpenter

                 reply	other threads:[~2022-05-23  7:24 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=Yos1JTu75ddjVYk7@kili \
    --to=dan.carpenter@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.