In current UFS task abort hook, namely ufshcd_abort(), if one task is aborted successfully, clk_gating.active_reqs held by this task is not decreased, which makes clk_gating.active_reqs stay above zero forever, thus clock gating would never happen. Instead of releasing resources of one task "manually", use the existing func __ufshcd_transfer_req_compl(). This change can also eliminate possible racing of scsi_dma_unmap() from the real completion in IRQ handler path. Fixes: 5a0b0cb9bee76 ("ufs: Add support for clock gating") Signed-off-by: Can Guo <cang@xxxxxxxxxxxxxx> CC: Stanley Chu <stanley.chu@xxxxxxxxxxxx> Reviewed-by: Stanley Chu <stanley.chu@xxxxxxxxxxxx> Reviewed-by: Asutosh Das <asutoshd@xxxxxxxxxxxxxx> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9ebb5cd..efb40b1 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) goto out; } - scsi_dma_unmap(cmd); - spin_lock_irqsave(host->host_lock, flags); - ufshcd_outstanding_req_clear(hba, tag); - hba->lrb[tag].cmd = NULL; + __ufshcd_transfer_req_compl(hba, (1UL << tag)); spin_unlock_irqrestore(host->host_lock, flags); out: -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.