diff mbox series

[6/6] gpio: zynq: Simplify with dev_err_probe()

Message ID 20200827200827.26462-6-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/6] gpio: bcm-kona: Simplify with dev_err_probe() | expand

Commit Message

Krzysztof Kozlowski Aug. 27, 2020, 8:08 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/gpio/gpio-zynq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Michal Simek Aug. 28, 2020, 5:20 a.m. UTC | #1
On 27. 08. 20 22:08, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/gpio/gpio-zynq.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index 53d1387592fd..0b5a17ab996f 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -929,11 +929,9 @@ static int zynq_gpio_probe(struct platform_device *pdev)
>  
>  	/* Retrieve GPIO clock */
>  	gpio->clk = devm_clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(gpio->clk)) {
> -		if (PTR_ERR(gpio->clk) != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "input clock not found.\n");
> -		return PTR_ERR(gpio->clk);
> -	}
> +	if (IS_ERR(gpio->clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n");
> +
>  	ret = clk_prepare_enable(gpio->clk);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Unable to enable clock.\n");
> 

Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal
Linus Walleij Sept. 12, 2020, 9:26 a.m. UTC | #2
On Thu, Aug 27, 2020 at 10:08 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:

> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

All six patches applied!

Thanks!
Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 53d1387592fd..0b5a17ab996f 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -929,11 +929,9 @@  static int zynq_gpio_probe(struct platform_device *pdev)
 
 	/* Retrieve GPIO clock */
 	gpio->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(gpio->clk)) {
-		if (PTR_ERR(gpio->clk) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "input clock not found.\n");
-		return PTR_ERR(gpio->clk);
-	}
+	if (IS_ERR(gpio->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n");
+
 	ret = clk_prepare_enable(gpio->clk);
 	if (ret) {
 		dev_err(&pdev->dev, "Unable to enable clock.\n");