The hostdata array, which is denoted by 'hba' in ufs driver, should
not be accessed after calling scsi_host_put().

Signed-off-by: Akinobu Mita <[email protected]>
Cc: Vinayak Holikatti <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Dolev Raviv <[email protected]>
Cc: Sujit Reddy Thumma <[email protected]>
Cc: Subhash Jadavani <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Sahitya Tummala <[email protected]>
Cc: [email protected]
---
 drivers/scsi/ufs/ufshcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b0ade73..e25f919 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5363,12 +5363,12 @@ void ufshcd_remove(struct ufs_hba *hba)
        ufshcd_disable_intr(hba, hba->intr_mask);
        ufshcd_hba_stop(hba);
 
-       scsi_host_put(hba->host);
-
        ufshcd_exit_clk_gating(hba);
        if (ufshcd_is_clkscaling_enabled(hba))
                devfreq_remove_device(hba->devfreq);
        ufshcd_hba_exit(hba);
+
+       scsi_host_put(hba->host);
 }
 EXPORT_SYMBOL_GPL(ufshcd_remove);
 
@@ -5671,9 +5671,9 @@ exit_gating:
        ufshcd_exit_clk_gating(hba);
 out_disable:
        hba->is_irq_enabled = false;
-       scsi_host_put(host);
        ufshcd_hba_exit(hba);
 out_error:
+       scsi_host_put(host);
        return err;
 }
 EXPORT_SYMBOL_GPL(ufshcd_init);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to