Commit 74a527a2 authored by Can Guo's avatar Can Guo Committed by Martin K. Petersen
Browse files

scsi: ufs: Avoid messing up the compl_time_stamp of lrbs

To be on the safe side, do not touch lrb after clearing its slot in the
lrb_in_use bitmap to avoid messing up the next task which would possibly
occupy this lrb.

[mkp: applied by hand]

Link: https://lore.kernel.org/r/1574751214-8321-4-git-send-email-cang@qti.qualcomm.com


Reviewed by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a7ef6f02
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4793,11 +4793,13 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
			cmd->result = result;
			/* Mark completed command as NULL in LRB */
			lrbp->cmd = NULL;
			lrbp->compl_time_stamp = ktime_get();
			/* Do not touch lrbp after scsi done */
			cmd->scsi_done(cmd);
			__ufshcd_release(hba);
		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
			lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
			lrbp->compl_time_stamp = ktime_get();
			if (hba->dev_cmd.complete) {
				ufshcd_add_command_trace(hba, index,
						"dev_complete");
@@ -4806,8 +4808,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
		}
		if (ufshcd_is_clkscaling_supported(hba))
			hba->clk_scaling.active_reqs--;

		lrbp->compl_time_stamp = ktime_get();
	}

	/* clear corresponding bits of completed commands */