Re: [PATCH 2/2] scsi: ufs: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()

Can Guo
2023-12-19T05:06:16Z

On 12/19/2023 6:52 AM, Bart Van Assche wrote:
> 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 <danielmentz@google.com>
> Fixes: 1d337ec2f35e ("ufs: improve init sequence")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> 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 0ad8bde39cd1..7c59d7a02243 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8982,12 +8982,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)

Reviewed-by: Can Guo <quic_cang@quicinc.com>