From 57579a4a2a81634c0189b7e0df1c7766fd1b605b Mon Sep 17 00:00:00 2001 From: hgchu Date: Fri, 12 Jan 2018 13:24:38 +0900 Subject: [PATCH] [COMMON] ufs: exynos: fix race of error recovery 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 --- drivers/scsi/ufs/ufshcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7df4c38ecdfe..ae6b90659e32 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -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) -- 2.20.1