All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] scsi: ufs: Abort tasks before clearing them from doorbell
@ 2022-05-23  7:17 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-05-23  7:17 UTC (permalink / raw)
  Cc: linux-scsi

[ 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-23  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23  7:17 [bug report] scsi: ufs: Abort tasks before clearing them from doorbell Dan Carpenter

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.