linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH v2 2/2] watchdog: s3c2410_wdt: Simplify using dev_err_probe()
Date: Tue, 7 Mar 2023 08:37:19 -0800	[thread overview]
Message-ID: <51057d03-f421-4e76-b293-d186ba0f78a2@roeck-us.net> (raw)
In-Reply-To: <20230307065603.2253054-3-u.kleine-koenig@pengutronix.de>

On Tue, Mar 07, 2023 at 07:56:03AM +0100, Uwe Kleine-König wrote:
> Make use of dev_err_probe() also for error paths that don't have to
> handle -EPROBE_DEFER. While the code handing -EPROBE_DEFER isn't used
> for these error paths, it still simpler as it cares for pretty printing
> the error code and usually needs one code line less as it combines
> message emitting and error returning. This also unifies the format of
> the error messages.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/s3c2410_wdt.c | 29 ++++++++++-------------------
>  1 file changed, 10 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index f3de8ef499c3..e14d6d9050ce 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -601,10 +601,8 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
>  
>  		err = of_property_read_u32(dev->of_node,
>  					   "samsung,cluster-index", &index);
> -		if (err) {
> -			dev_err(dev, "failed to get cluster index\n");
> -			return -EINVAL;
> -		}
> +		if (err)
> +			return dev_err_probe(dev, -EINVAL, "failed to get cluster index\n");
>  
>  		switch (index) {
>  		case 0:
> @@ -615,8 +613,7 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
>  				&drv_data_exynosautov9_cl1;
>  			break;
>  		default:
> -			dev_err(dev, "wrong cluster index: %u\n", index);
> -			return -EINVAL;
> +			return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index);
>  		}
>  	}
>  #endif
> @@ -653,10 +650,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>  	if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) {
>  		wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
>  						"samsung,syscon-phandle");
> -		if (IS_ERR(wdt->pmureg)) {
> -			dev_err(dev, "syscon regmap lookup failed.\n");
> -			return PTR_ERR(wdt->pmureg);
> -		}
> +		if (IS_ERR(wdt->pmureg))
> +			return dev_err_probe(dev, PTR_ERR(wdt->pmureg), "syscon regmap lookup failed.\n");
>  	}
>  
>  	wdt_irq = platform_get_irq(pdev, 0);
> @@ -694,21 +689,17 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>  	if (ret) {
>  		ret = s3c2410wdt_set_heartbeat(&wdt->wdt_device,
>  					       S3C2410_WATCHDOG_DEFAULT_TIME);
> -		if (ret == 0) {
> +		if (ret == 0)
>  			dev_warn(dev, "tmr_margin value out of range, default %d used\n",
>  				 S3C2410_WATCHDOG_DEFAULT_TIME);
> -		} else {
> -			dev_err(dev, "failed to use default timeout\n");
> -			return ret;
> -		}
> +		else
> +			return dev_err_probe(dev, ret, "failed to use default timeout\n");
>  	}
>  
>  	ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0,
>  			       pdev->name, pdev);
> -	if (ret != 0) {
> -		dev_err(dev, "failed to install irq (%d)\n", ret);
> -		return ret;
> -	}
> +	if (ret != 0)
> +		return dev_err_probe(dev, ret, "failed to install irq (%d)\n", ret);
>  
>  	watchdog_set_nowayout(&wdt->wdt_device, nowayout);
>  	watchdog_set_restart_priority(&wdt->wdt_device, 128);
> -- 
> 2.39.1
> 

      reply	other threads:[~2023-03-07 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  6:56 [PATCH v2 0/2] watchdog: s3c2410_wdt: Simplify using dev_err_probe() Uwe Kleine-König
2023-03-07  6:56 ` [PATCH v2 1/2] watchdog: s3c2410: Make s3c2410_get_wdt_drv_data() return an int Uwe Kleine-König
2023-03-07 16:37   ` Guenter Roeck
2023-03-07  6:56 ` [PATCH v2 2/2] watchdog: s3c2410_wdt: Simplify using dev_err_probe() Uwe Kleine-König
2023-03-07 16:37   ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51057d03-f421-4e76-b293-d186ba0f78a2@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alim.akhtar@samsung.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).