Re: [PATCH 3/3] scsi: ufs: core: Always run tx_eqtr POST_CHANGE notify

From: Manivannan Sadhasivam

Date: Tue Jun 23 2026 - 02:46:02 EST


On Sat, Jun 20, 2026 at 01:03:22AM -0700, Can Guo wrote:
> ufshcd_tx_eqtr() skips POST_CHANGE notify when __ufshcd_tx_eqtr()
> fails. That can leave variant cleanup incomplete when PRE_CHANGE saved
> temporary state that POST_CHANGE is expected to restore.
>
> Always call POST_CHANGE once PRE_CHANGE has succeeded. Keep the TX EQTR
> result as the primary return value, and only propagate POST_CHANGE
> failure when TX EQTR itself succeeded.
>
> Log PRE_CHANGE and POST_CHANGE notify failures to make variant callback
> failures visible in TX EQTR error paths.
>
> Signed-off-by: Can Guo <can.guo@xxxxxxxxxxxxxxxx>

Reviewed-by: Manivannan Sadhasivam <mani@xxxxxxxxxx>

- Mani

> ---
> drivers/ufs/core/ufs-txeq.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ufs/core/ufs-txeq.c b/drivers/ufs/core/ufs-txeq.c
> index 23a12e221d31..c39a623b4fe1 100644
> --- a/drivers/ufs/core/ufs-txeq.c
> +++ b/drivers/ufs/core/ufs-txeq.c
> @@ -1224,6 +1224,7 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
> {
> struct ufs_pa_layer_attr old_pwr_info;
> unsigned int noio_flag;
> + int notify_ret;
> int ret;
>
> /*
> @@ -1253,14 +1254,19 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba,
> }
>
> ret = ufshcd_vops_tx_eqtr_notify(hba, PRE_CHANGE, pwr_mode);
> - if (ret)
> + if (ret) {
> + dev_err(hba->dev, "TX EQTR PRE_CHANGE notify failed: %d\n", ret);
> goto out;
> + }
>
> ret = __ufshcd_tx_eqtr(hba, params, pwr_mode);
> - if (ret)
> - goto out;
>
> - ret = ufshcd_vops_tx_eqtr_notify(hba, POST_CHANGE, pwr_mode);
> + notify_ret = ufshcd_vops_tx_eqtr_notify(hba, POST_CHANGE, pwr_mode);
> + if (notify_ret)
> + dev_err(hba->dev, "TX EQTR POST_CHANGE notify failed: %d\n", notify_ret);
> +
> + if (!ret)
> + ret = notify_ret;
>
> out:
> if (ret)
> --
> 2.34.1
>

--
மணிவண்ணன் சதாசிவம்