Message ID | 20200901153141.18960-2-krzk@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] watchdog: cadence: Simplify with dev_err_probe() | expand |
On Tue, Sep 01, 2020 at 05:31:40PM +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> > --- > drivers/watchdog/davinci_wdt.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c > index 2b3f3cd382ef..e6eaba6bae5b 100644 > --- a/drivers/watchdog/davinci_wdt.c > +++ b/drivers/watchdog/davinci_wdt.c > @@ -206,12 +206,9 @@ static int davinci_wdt_probe(struct platform_device *pdev) > return -ENOMEM; > > davinci_wdt->clk = devm_clk_get(dev, NULL); > - > - if (IS_ERR(davinci_wdt->clk)) { > - if (PTR_ERR(davinci_wdt->clk) != -EPROBE_DEFER) > - dev_err(dev, "failed to get clock node\n"); > - return PTR_ERR(davinci_wdt->clk); > - } > + if (IS_ERR(davinci_wdt->clk)) > + return dev_err_probe(dev, PTR_ERR(davinci_wdt->clk), > + "failed to get clock node\n"); > > ret = clk_prepare_enable(davinci_wdt->clk); > if (ret) { > -- > 2.17.1 >
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 2b3f3cd382ef..e6eaba6bae5b 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c @@ -206,12 +206,9 @@ static int davinci_wdt_probe(struct platform_device *pdev) return -ENOMEM; davinci_wdt->clk = devm_clk_get(dev, NULL); - - if (IS_ERR(davinci_wdt->clk)) { - if (PTR_ERR(davinci_wdt->clk) != -EPROBE_DEFER) - dev_err(dev, "failed to get clock node\n"); - return PTR_ERR(davinci_wdt->clk); - } + if (IS_ERR(davinci_wdt->clk)) + return dev_err_probe(dev, PTR_ERR(davinci_wdt->clk), + "failed to get clock node\n"); ret = clk_prepare_enable(davinci_wdt->clk); if (ret) {
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/davinci_wdt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)