diff mbox series

[v6,09/10] scsi: ufs: ufs-qcom: Check return value of phy_set_mode_ext()

Message ID 1701246516-11626-10-git-send-email-quic_cang@quicinc.com (mailing list archive)
State Superseded
Headers show
Series Enable HS-G5 support on SM8550 | expand

Commit Message

Can Guo Nov. 29, 2023, 8:28 a.m. UTC
In ufs_qcom_power_up_sequence(), check return value of phy_set_mode_ext()
and stop proceeding if phy_set_mode_ext() fails.

Signed-off-by: Can Guo <quic_cang@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Nitin Rawat Nov. 29, 2023, 8:38 a.m. UTC | #1
On 11/29/2023 1:58 PM, Can Guo wrote:
> In ufs_qcom_power_up_sequence(), check return value of phy_set_mode_ext()
> and stop proceeding if phy_set_mode_ext() fails.
> 
> Signed-off-by: Can Guo <quic_cang@quicinc.com>
> ---
>   drivers/ufs/host/ufs-qcom.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 30f4ca6..9c0ebbc 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -475,7 +475,12 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
>   		return ret;
>   	}
>   
> -	phy_set_mode_ext(phy, mode, host->phy_gear);
> +	ret = phy_set_mode_ext(phy, mode, host->phy_gear);
> +	if (ret) {
> +		dev_err(hba->dev, "%s: phy set mode failed, ret = %d\n",
> +			__func__, ret);
> +		goto out_disable_phy;
> +	}
>   
>   	/* power on phy - start serdes and phy's power and clocks */
>   	ret = phy_power_on(phy);

Reviewed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Manivannan Sadhasivam Nov. 30, 2023, 7:16 a.m. UTC | #2
On Wed, Nov 29, 2023 at 12:28:34AM -0800, Can Guo wrote:
> In ufs_qcom_power_up_sequence(), check return value of phy_set_mode_ext()
> and stop proceeding if phy_set_mode_ext() fails.
> 
> Signed-off-by: Can Guo <quic_cang@quicinc.com>
> ---
>  drivers/ufs/host/ufs-qcom.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 30f4ca6..9c0ebbc 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -475,7 +475,12 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
>  		return ret;
>  	}
>  
> -	phy_set_mode_ext(phy, mode, host->phy_gear);
> +	ret = phy_set_mode_ext(phy, mode, host->phy_gear);
> +	if (ret) {
> +		dev_err(hba->dev, "%s: phy set mode failed, ret = %d\n",
> +			__func__, ret);

No need to print the error message here as it is already done in the PHY driver.

Also, this patch should come before the PHY patch returning error.

- Mani

> +		goto out_disable_phy;
> +	}
>  
>  	/* power on phy - start serdes and phy's power and clocks */
>  	ret = phy_power_on(phy);
> -- 
> 2.7.4
> 
>
Can Guo Nov. 30, 2023, 8:19 a.m. UTC | #3
On 11/30/2023 3:16 PM, Manivannan Sadhasivam wrote:
> On Wed, Nov 29, 2023 at 12:28:34AM -0800, Can Guo wrote:
>> In ufs_qcom_power_up_sequence(), check return value of phy_set_mode_ext()
>> and stop proceeding if phy_set_mode_ext() fails.
>>
>> Signed-off-by: Can Guo <quic_cang@quicinc.com>
>> ---
>>   drivers/ufs/host/ufs-qcom.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
>> index 30f4ca6..9c0ebbc 100644
>> --- a/drivers/ufs/host/ufs-qcom.c
>> +++ b/drivers/ufs/host/ufs-qcom.c
>> @@ -475,7 +475,12 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
>>   		return ret;
>>   	}
>>   
>> -	phy_set_mode_ext(phy, mode, host->phy_gear);
>> +	ret = phy_set_mode_ext(phy, mode, host->phy_gear);
>> +	if (ret) {
>> +		dev_err(hba->dev, "%s: phy set mode failed, ret = %d\n",
>> +			__func__, ret);
> 
> No need to print the error message here as it is already done in the PHY driver.
> 
> Also, this patch should come before the PHY patch returning error.

Sure.

Thanks,
Can Guo.

> 
> - Mani
> 
>> +		goto out_disable_phy;
>> +	}
>>   
>>   	/* power on phy - start serdes and phy's power and clocks */
>>   	ret = phy_power_on(phy);
>> -- 
>> 2.7.4
>>
>>
>
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 30f4ca6..9c0ebbc 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -475,7 +475,12 @@  static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
 		return ret;
 	}
 
-	phy_set_mode_ext(phy, mode, host->phy_gear);
+	ret = phy_set_mode_ext(phy, mode, host->phy_gear);
+	if (ret) {
+		dev_err(hba->dev, "%s: phy set mode failed, ret = %d\n",
+			__func__, ret);
+		goto out_disable_phy;
+	}
 
 	/* power on phy - start serdes and phy's power and clocks */
 	ret = phy_power_on(phy);