diff mbox series

[v2] power: reset: gpio-restart: don't error on deferral

Message ID 20191029201726.12786-1-chris.packham@alliedtelesis.co.nz (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2] power: reset: gpio-restart: don't error on deferral | expand

Commit Message

Chris Packham Oct. 29, 2019, 8:17 p.m. UTC
Don't generate an error message when devm_gpiod_get fails with
-EPROBE_DEFER.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    Changes in v2:
    - use PTR_ERR_OR_ZERO() to avoid excessive PTR_ERR()

 drivers/power/reset/gpio-restart.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Sebastian Reichel Dec. 19, 2019, 12:16 a.m. UTC | #1
Hi,

On Wed, Oct 30, 2019 at 09:17:26AM +1300, Chris Packham wrote:
> Don't generate an error message when devm_gpiod_get fails with
> -EPROBE_DEFER.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---

Thanks, queued to power-supply's for-next branch.

-- Sebastian

> 
> Notes:
>     Changes in v2:
>     - use PTR_ERR_OR_ZERO() to avoid excessive PTR_ERR()
> 
>  drivers/power/reset/gpio-restart.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/reset/gpio-restart.c b/drivers/power/reset/gpio-restart.c
> index 308ca9d9d276..5466eeea261c 100644
> --- a/drivers/power/reset/gpio-restart.c
> +++ b/drivers/power/reset/gpio-restart.c
> @@ -64,9 +64,11 @@ static int gpio_restart_probe(struct platform_device *pdev)
>  
>  	gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
>  			open_source ? GPIOD_IN : GPIOD_OUT_LOW);
> -	if (IS_ERR(gpio_restart->reset_gpio)) {
> -		dev_err(&pdev->dev, "Could not get reset GPIO\n");
> -		return PTR_ERR(gpio_restart->reset_gpio);
> +	ret = PTR_ERR_OR_ZERO(gpio_restart->reset_gpio);
> +	if (ret) {
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Could not get reset GPIO\n");
> +		return ret;
>  	}
>  
>  	gpio_restart->restart_handler.notifier_call = gpio_restart_notify;
> -- 
> 2.23.0
>
diff mbox series

Patch

diff --git a/drivers/power/reset/gpio-restart.c b/drivers/power/reset/gpio-restart.c
index 308ca9d9d276..5466eeea261c 100644
--- a/drivers/power/reset/gpio-restart.c
+++ b/drivers/power/reset/gpio-restart.c
@@ -64,9 +64,11 @@  static int gpio_restart_probe(struct platform_device *pdev)
 
 	gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
 			open_source ? GPIOD_IN : GPIOD_OUT_LOW);
-	if (IS_ERR(gpio_restart->reset_gpio)) {
-		dev_err(&pdev->dev, "Could not get reset GPIO\n");
-		return PTR_ERR(gpio_restart->reset_gpio);
+	ret = PTR_ERR_OR_ZERO(gpio_restart->reset_gpio);
+	if (ret) {
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Could not get reset GPIO\n");
+		return ret;
 	}
 
 	gpio_restart->restart_handler.notifier_call = gpio_restart_notify;