diff mbox series

[10/13] scsi: ufs: qcom: Use dev_err_probe() to simplify error handling of devm_gpiod_get_optional()

Message ID 20231201151417.65500-11-manivannan.sadhasivam@linaro.org (mailing list archive)
State Superseded
Headers show
Series scsi: ufs: qcom: Minor code cleanups | expand

Commit Message

Manivannan Sadhasivam Dec. 1, 2023, 3:14 p.m. UTC
As done in other places, let's use dev_err_probe() to simplify the error
handling while acquiring the device reset gpio using
devm_gpiod_get_optional().

While at it, let's reword the error message to make it clear that the
failure is due to acquiring "device reset gpio".

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/ufs/host/ufs-qcom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andrew Halaney Dec. 6, 2023, 6:52 p.m. UTC | #1
On Fri, Dec 01, 2023 at 08:44:14PM +0530, Manivannan Sadhasivam wrote:
> As done in other places, let's use dev_err_probe() to simplify the error
> handling while acquiring the device reset gpio using
> devm_gpiod_get_optional().
> 
> While at it, let's reword the error message to make it clear that the
> failure is due to acquiring "device reset gpio".
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>

> ---
>  drivers/ufs/host/ufs-qcom.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 218d22e1efce..a86f6620abc8 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -1146,9 +1146,8 @@ static int ufs_qcom_init(struct ufs_hba *hba)
>  	host->device_reset = devm_gpiod_get_optional(dev, "reset",
>  						     GPIOD_OUT_HIGH);
>  	if (IS_ERR(host->device_reset)) {
> -		err = PTR_ERR(host->device_reset);
> -		if (err != -EPROBE_DEFER)
> -			dev_err(dev, "failed to acquire reset gpio: %d\n", err);
> +		err = dev_err_probe(dev, PTR_ERR(host->device_reset),
> +				    "Failed to acquire device reset gpio\n");
>  		goto out_variant_clear;
>  	}
>  
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 218d22e1efce..a86f6620abc8 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1146,9 +1146,8 @@  static int ufs_qcom_init(struct ufs_hba *hba)
 	host->device_reset = devm_gpiod_get_optional(dev, "reset",
 						     GPIOD_OUT_HIGH);
 	if (IS_ERR(host->device_reset)) {
-		err = PTR_ERR(host->device_reset);
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "failed to acquire reset gpio: %d\n", err);
+		err = dev_err_probe(dev, PTR_ERR(host->device_reset),
+				    "Failed to acquire device reset gpio\n");
 		goto out_variant_clear;
 	}