Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30cb7c0d authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs: do pm qos unvoting before calling scsi_done callback



We shouldn't be accessing scsi command's "request" structure after calling
scsi_done callback but it seems pm qos unvoting code path is accessing
this request structure even after caling the scsi_done callback. Fix this
by releasing the pm qos vote before calling scsi_done.

Change-Id: I5c8dd6ba7f0b619397924d73c1fd6c36fe86ebc1
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 40b49a34
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -4894,9 +4894,17 @@ void ufshcd_abort_outstanding_transfer_requests(struct ufs_hba *hba, int result)
			update_req_stats(hba, lrbp);
			/* Mark completed command as NULL in LRB */
			lrbp->cmd = NULL;
			ufshcd_release_all(hba);
			if (cmd->request)
				/*
				 * As we are accessing the "request" structure,
				 * this must be called before calling
				 * ->scsi_done() callback.
				 */
				ufshcd_vops_pm_qos_req_end(hba, cmd->request,
					true);
			/* Do not touch lrbp after scsi done */
			cmd->scsi_done(cmd);
			ufshcd_release_all(hba);
		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE) {
			if (hba->dev_cmd.complete) {
				ufshcd_cond_add_cmd_trace(hba, index,
@@ -4937,13 +4945,18 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
			update_req_stats(hba, lrbp);
			/* Mark completed command as NULL in LRB */
			lrbp->cmd = NULL;
			/* Do not touch lrbp after scsi done */
			cmd->scsi_done(cmd);
			__ufshcd_release(hba, false);
			__ufshcd_hibern8_release(hba, false);
			if (cmd->request)
				/*
				 * As we are accessing the "request" structure,
				 * this must be called before calling
				 * ->scsi_done() callback.
				 */
				ufshcd_vops_pm_qos_req_end(hba, cmd->request,
					false);
			/* Do not touch lrbp after scsi done */
			cmd->scsi_done(cmd);
		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE) {
			if (hba->dev_cmd.complete) {
				ufshcd_cond_add_cmd_trace(hba, index,