Skip to content

Commit d53b681

Browse files
Chanwoo Leemartinkpetersen
authored andcommitted
scsi: ufs: mcq: Fix error output and clean up ufshcd_mcq_abort()
An error unrelated to ufshcd_try_to_abort_task is being logged and can cause confusion. Modify ufshcd_mcq_abort() to print the result of the abort failure. For readability, return immediately instead of 'goto'. Fixes: f1304d4 ("scsi: ufs: mcq: Added ufshcd_mcq_abort()") Signed-off-by: Chanwoo Lee <cw9316.lee@samsung.com> Link: https://lore.kernel.org/r/20240524015904.1116005-1-cw9316.lee@samsung.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 4fedb1f commit d53b681

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -634,20 +634,20 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
634634
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
635635
struct ufs_hw_queue *hwq;
636636
unsigned long flags;
637-
int err = FAILED;
637+
int err;
638638

639639
if (!ufshcd_cmd_inflight(lrbp->cmd)) {
640640
dev_err(hba->dev,
641641
"%s: skip abort. cmd at tag %d already completed.\n",
642642
__func__, tag);
643-
goto out;
643+
return FAILED;
644644
}
645645

646646
/* Skip task abort in case previous aborts failed and report failure */
647647
if (lrbp->req_abort_skip) {
648648
dev_err(hba->dev, "%s: skip abort. tag %d failed earlier\n",
649649
__func__, tag);
650-
goto out;
650+
return FAILED;
651651
}
652652

653653
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
@@ -659,26 +659,25 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
659659
*/
660660
dev_err(hba->dev, "%s: cmd found in sq. hwq=%d, tag=%d\n",
661661
__func__, hwq->id, tag);
662-
goto out;
662+
return FAILED;
663663
}
664664

665665
/*
666666
* The command is not in the submission queue, and it is not
667667
* in the completion queue either. Query the device to see if
668668
* the command is being processed in the device.
669669
*/
670-
if (ufshcd_try_to_abort_task(hba, tag)) {
670+
err = ufshcd_try_to_abort_task(hba, tag);
671+
if (err) {
671672
dev_err(hba->dev, "%s: device abort failed %d\n", __func__, err);
672673
lrbp->req_abort_skip = true;
673-
goto out;
674+
return FAILED;
674675
}
675676

676-
err = SUCCESS;
677677
spin_lock_irqsave(&hwq->cq_lock, flags);
678678
if (ufshcd_cmd_inflight(lrbp->cmd))
679679
ufshcd_release_scsi_cmd(hba, lrbp);
680680
spin_unlock_irqrestore(&hwq->cq_lock, flags);
681681

682-
out:
683-
return err;
682+
return SUCCESS;
684683
}

0 commit comments

Comments
 (0)