watchdog: rti: Simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzk@kernel.org>
Tue, 1 Sep 2020 15:31:41 +0000 (17:31 +0200)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Wed, 14 Oct 2020 13:02:25 +0000 (15:02 +0200)
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>
Link: https://lore.kernel.org/r/20200901153141.18960-3-krzk@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/rti_wdt.c

index 705e8f7523e814f879592bc9df7077ef8f5bab62..836319cbaca9d7744a41cc4a91fb06265923b661 100644 (file)
@@ -205,11 +205,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        clk = clk_get(dev, NULL);
-       if (IS_ERR(clk)) {
-               if (PTR_ERR(clk) != -EPROBE_DEFER)
-                       dev_err(dev, "failed to get clock\n");
-               return PTR_ERR(clk);
-       }
+       if (IS_ERR(clk))
+               return dev_err_probe(dev, PTR_ERR(clk), "failed to get clock\n");
 
        wdt->freq = clk_get_rate(clk);
 
@@ -230,11 +227,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
 
        pm_runtime_enable(dev);
        ret = pm_runtime_get_sync(dev);
-       if (ret) {
-               if (ret != -EPROBE_DEFER)
-                       dev_err(&pdev->dev, "runtime pm failed\n");
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "runtime pm failed\n");
 
        platform_set_drvdata(pdev, wdt);