[COMMON] ufs: exynos: fix race of error recovery
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 04:24:38 +0000 (13:24 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:26 +0000 (17:20 +0900)
There are some race condition.when hci sfr dump starts in error handler,
if hibernation exit function send uic cmd with uic errors then race happens.
Therefore we make hibernation exit skip to send uic cmd when uic errors
happens.

Change-Id: I261f1cecca4210ddda6088d784790923373ae18d
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c

index 7df4c38ecdfe6050eef2bef3945677dbc2a7b6fd..ae6b90659e32fbcf9236608c1a6677fcc4e5ad80 100644 (file)
@@ -3910,7 +3910,14 @@ static int ufshcd_link_hibern8_ctrl(struct ufs_hba *hba, bool en)
                ret = ufshcd_uic_hibern8_enter(hba);
        else
                ret = ufshcd_uic_hibern8_exit(hba);
-       if (ret)
+
+       if (ret || (hba->saved_err & INT_FATAL_ERRORS) ||
+               ((hba->saved_err & UIC_ERROR) &&
+               ((hba->saved_uic_err & UFSHCD_UIC_DL_PA_INIT_ERROR) ||
+               (hba->saved_uic_err & UFSHCD_UIC_DL_ERROR)))) {
+
+               if (!ret)
+                       ret = hba->saved_err;
                goto out;
        }
        if (hba->vops && hba->vops->hibern8_notify)