watchdog: coh901327_wdt: Simplify error handling in probe function
authorGuenter Roeck <linux@roeck-us.net>
Tue, 3 Jan 2017 11:22:09 +0000 (03:22 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 24 Feb 2017 22:00:23 +0000 (14:00 -0800)
Checking if there is no error followed by a goto if there is one is
confusing. Reverse the logic.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/watchdog/coh901327_wdt.c

index a099b77..dc97b2f 100644 (file)
@@ -360,12 +360,10 @@ static int __init coh901327_probe(struct platform_device *pdev)
 
        coh901327_wdt.parent = &pdev->dev;
        ret = watchdog_register_device(&coh901327_wdt);
-       if (ret == 0)
-               dev_info(&pdev->dev,
-                        "initialized. timer margin=%d sec\n", margin);
-       else
+       if (ret)
                goto out_no_wdog;
 
+       dev_info(&pdev->dev, "initialized. timer margin=%d sec\n", margin);
        return 0;
 
 out_no_wdog: