diff options
| author | Subhash Jadavani <subhashj@codeaurora.org> | 2015-08-17 16:45:56 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:00:33 -0700 |
| commit | 946868509b8ef15b2b4a356cc03ab3095896541f (patch) | |
| tree | d2456a739bdad502bfe87755174dbe3be705d8a3 | |
| parent | 43ba62d81cafe4e55c871d2ec6bf4a26bb4f5414 (diff) | |
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: Subhash Jadavani <subhashj@codeaurora.org>
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 43a259b98436..2a521f39b4a2 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4870,9 +4870,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, @@ -4913,13 +4921,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, |
