[PATCH v4 01/11] scsi: ufs: dwc: Return a negative error if the link is down

Frank Li Frank.li at oss.nxp.com
Thu Sep 17 08:58:42 PDT 2026


On Thu, Sep 17, 2026 at 11:15:45AM +0200, Larisa Grigore wrote:
> ufshcd_dwc_link_is_up() returns 1 when the UniPro link is not up. The
> value may propagate through callers that expect failures to be reported as
> negative errno values.
>
> Return -ENOLINK when the link is down and propagate errors returned by
> ufshcd_dme_get().
>
> Fixes: 4b9ffb5a353b ("ufs: add support for DesignWare Controller")
> Signed-off-by: Larisa Grigore <larisa.grigore at oss.nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li at nxp.com>

>  drivers/ufs/host/ufshcd-dwc.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/ufs/host/ufshcd-dwc.c b/drivers/ufs/host/ufshcd-dwc.c
> index 21b1cf912dcc..ccf785fce6cc 100644
> --- a/drivers/ufs/host/ufshcd-dwc.c
> +++ b/drivers/ufs/host/ufshcd-dwc.c
> @@ -48,20 +48,23 @@ static void ufshcd_dwc_program_clk_div(struct ufs_hba *hba, u32 divider_val)
>   * ufshcd_dwc_link_is_up() - check if link is up.
>   * @hba: private structure pointer
>   *
> - * Return: 0 on success, non-zero value on failure.
> + * Return: 0 on success, a negative errno value on failure.
>   */
>  static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
>  {
>  	int dme_result = 0;
> +	int ret;
>
> -	ufshcd_dme_get(hba, UIC_ARG_MIB(VS_POWERSTATE), &dme_result);
> +	ret = ufshcd_dme_get(hba, UIC_ARG_MIB(VS_POWERSTATE), &dme_result);
> +	if (ret)
> +		return ret;
>
>  	if (dme_result == UFSHCD_LINK_IS_UP) {
>  		ufshcd_set_link_active(hba);
>  		return 0;
>  	}
>
> -	return 1;
> +	return -ENOLINK;
>  }
>
>  /**
> --
> 2.43.0
>
>



More information about the linux-arm-kernel mailing list