From 7c91752f5dd9d5c187e9c02282f726a0206e590b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 18 Dec 2023 14:52:15 -0800 Subject: [PATCH] FROMLIST: scsi: ufs: Remove the ufshcd_hba_exit() call from ufshcd_async_scan() Calling ufshcd_hba_exit() from a function that is called asynchronously from ufshcd_init() is wrong because this triggers multiple race conditions. Instead of calling ufshcd_hba_exit(), log an error message. Reported-by: Daniel Mentz Closes: https://b.corp.google.com/issues/310401362 Fixes: 1d337ec2f35e ("ufs: improve init sequence") Change-Id: I1c056c2e42889301f69107468f2b3eb38bf3d734 Signed-off-by: Bart Van Assche Bug: 310401362 Link: https://lore.kernel.org/linux-scsi/20231218225229.2542156-3-bvanassche@acm.org/ Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0a86de0feb79..0f0cfea31cbf 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8918,12 +8918,9 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) out: pm_runtime_put_sync(hba->dev); - /* - * If we failed to initialize the device or the device is not - * present, turn off the power/clocks etc. - */ + if (ret) - ufshcd_hba_exit(hba); + dev_err(hba->dev, "%s failed: %d\n", __func__, ret); } static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)