diff mbox series

[05/11] usb: dwc3: imx8mp: simplify with dev_err_probe

Message ID 20240814-b4-cleanup-h-of-node-put-usb-v1-5-95481b9682bc@linaro.org (mailing list archive)
State New
Headers show
Series usb: dwc3: various cleanups | expand

Commit Message

Krzysztof Kozlowski Aug. 14, 2024, 10:35 a.m. UTC
Use dev_err_probe() to make the error paths a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/usb/dwc3/dwc3-imx8mp.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Frank Li Aug. 14, 2024, 3:44 p.m. UTC | #1
On Wed, Aug 14, 2024 at 12:35:41PM +0200, Krzysztof Kozlowski wrote:
> Use dev_err_probe() to make the error paths a bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

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

> ---
>  drivers/usb/dwc3/dwc3-imx8mp.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
> index 8c91e595d3b9..869b5e7c15ed 100644
> --- a/drivers/usb/dwc3/dwc3-imx8mp.c
> +++ b/drivers/usb/dwc3/dwc3-imx8mp.c
> @@ -179,18 +179,14 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
>  	}
>
>  	dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio");
> -	if (IS_ERR(dwc3_imx->hsio_clk)) {
> -		err = PTR_ERR(dwc3_imx->hsio_clk);
> -		dev_err(dev, "Failed to get hsio clk, err=%d\n", err);
> -		return err;
> -	}
> +	if (IS_ERR(dwc3_imx->hsio_clk))
> +		return dev_err_probe(dev, PTR_ERR(dwc3_imx->hsio_clk),
> +				     "Failed to get hsio clk\n");
>
>  	dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend");
> -	if (IS_ERR(dwc3_imx->suspend_clk)) {
> -		err = PTR_ERR(dwc3_imx->suspend_clk);
> -		dev_err(dev, "Failed to get suspend clk, err=%d\n", err);
> -		return err;
> -	}
> +	if (IS_ERR(dwc3_imx->suspend_clk))
> +		return dev_err_probe(dev, PTR_ERR(dwc3_imx->suspend_clk),
> +				     "Failed to get suspend clk\n");
>
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>
> --
> 2.43.0
>
Thinh Nguyen Aug. 27, 2024, 1:27 a.m. UTC | #2
On Wed, Aug 14, 2024, Krzysztof Kozlowski wrote:
> Use dev_err_probe() to make the error paths a bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-imx8mp.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
> index 8c91e595d3b9..869b5e7c15ed 100644
> --- a/drivers/usb/dwc3/dwc3-imx8mp.c
> +++ b/drivers/usb/dwc3/dwc3-imx8mp.c
> @@ -179,18 +179,14 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
>  	}
>  
>  	dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio");
> -	if (IS_ERR(dwc3_imx->hsio_clk)) {
> -		err = PTR_ERR(dwc3_imx->hsio_clk);
> -		dev_err(dev, "Failed to get hsio clk, err=%d\n", err);
> -		return err;
> -	}
> +	if (IS_ERR(dwc3_imx->hsio_clk))
> +		return dev_err_probe(dev, PTR_ERR(dwc3_imx->hsio_clk),
> +				     "Failed to get hsio clk\n");
>  
>  	dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend");
> -	if (IS_ERR(dwc3_imx->suspend_clk)) {
> -		err = PTR_ERR(dwc3_imx->suspend_clk);
> -		dev_err(dev, "Failed to get suspend clk, err=%d\n", err);
> -		return err;
> -	}
> +	if (IS_ERR(dwc3_imx->suspend_clk))
> +		return dev_err_probe(dev, PTR_ERR(dwc3_imx->suspend_clk),
> +				     "Failed to get suspend clk\n");
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
> 
> -- 
> 2.43.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index 8c91e595d3b9..869b5e7c15ed 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -179,18 +179,14 @@  static int dwc3_imx8mp_probe(struct platform_device *pdev)
 	}
 
 	dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio");
-	if (IS_ERR(dwc3_imx->hsio_clk)) {
-		err = PTR_ERR(dwc3_imx->hsio_clk);
-		dev_err(dev, "Failed to get hsio clk, err=%d\n", err);
-		return err;
-	}
+	if (IS_ERR(dwc3_imx->hsio_clk))
+		return dev_err_probe(dev, PTR_ERR(dwc3_imx->hsio_clk),
+				     "Failed to get hsio clk\n");
 
 	dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend");
-	if (IS_ERR(dwc3_imx->suspend_clk)) {
-		err = PTR_ERR(dwc3_imx->suspend_clk);
-		dev_err(dev, "Failed to get suspend clk, err=%d\n", err);
-		return err;
-	}
+	if (IS_ERR(dwc3_imx->suspend_clk))
+		return dev_err_probe(dev, PTR_ERR(dwc3_imx->suspend_clk),
+				     "Failed to get suspend clk\n");
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)