diff mbox series

[1/3] watchdog: cadence: Simplify with dev_err_probe()

Message ID 20200901153141.18960-1-krzk@kernel.org (mailing list archive)
State Accepted
Headers show
Series [1/3] watchdog: cadence: Simplify with dev_err_probe() | expand

Commit Message

Krzysztof Kozlowski Sept. 1, 2020, 3:31 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/watchdog/cadence_wdt.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Guenter Roeck Sept. 1, 2020, 8:18 p.m. UTC | #1
On Tue, Sep 01, 2020 at 05:31:39PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Hmm, I had replied to this but I don't see it on patchwork.
Trying again.

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

Guenter

> ---
>  drivers/watchdog/cadence_wdt.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index 672b184da875..bc99e9164930 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -334,12 +334,9 @@ static int cdns_wdt_probe(struct platform_device *pdev)
>  	watchdog_set_drvdata(cdns_wdt_device, wdt);
>  
>  	wdt->clk = devm_clk_get(dev, NULL);
> -	if (IS_ERR(wdt->clk)) {
> -		ret = PTR_ERR(wdt->clk);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "input clock not found\n");
> -		return ret;
> -	}
> +	if (IS_ERR(wdt->clk))
> +		return dev_err_probe(dev, PTR_ERR(wdt->clk),
> +				     "input clock not found\n");
>  
>  	ret = clk_prepare_enable(wdt->clk);
>  	if (ret) {
> -- 
> 2.17.1
>
Krzysztof Kozlowski Oct. 2, 2020, 4:31 p.m. UTC | #2
On Tue, Sep 01, 2020 at 08:49:52AM -0700, Guenter Roeck wrote:
> On Tue, Sep 01, 2020 at 05:31:39PM +0200, Krzysztof Kozlowski wrote:
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and the error value gets printed.
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Thanks for the review. Who could pick up these patches?

Best regards,
Krzysztof
Guenter Roeck Oct. 2, 2020, 5:37 p.m. UTC | #3
On Fri, Oct 02, 2020 at 06:31:24PM +0200, Krzysztof Kozlowski wrote:
> On Tue, Sep 01, 2020 at 08:49:52AM -0700, Guenter Roeck wrote:
> > On Tue, Sep 01, 2020 at 05:31:39PM +0200, Krzysztof Kozlowski wrote:
> > > Common pattern of handling deferred probe can be simplified with
> > > dev_err_probe().  Less code and the error value gets printed.
> > > 
> > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > 
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> Thanks for the review. Who could pick up these patches?
> 

They are queued up in my watchdog-next branch, and Wim usually
picks up patches from there.

Guenter
diff mbox series

Patch

diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
index 672b184da875..bc99e9164930 100644
--- a/drivers/watchdog/cadence_wdt.c
+++ b/drivers/watchdog/cadence_wdt.c
@@ -334,12 +334,9 @@  static int cdns_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(cdns_wdt_device, wdt);
 
 	wdt->clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(wdt->clk)) {
-		ret = PTR_ERR(wdt->clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "input clock not found\n");
-		return ret;
-	}
+	if (IS_ERR(wdt->clk))
+		return dev_err_probe(dev, PTR_ERR(wdt->clk),
+				     "input clock not found\n");
 
 	ret = clk_prepare_enable(wdt->clk);
 	if (ret) {