Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550411 > unrolled thread

[PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-01-04 04:30 +0100
Last post2017-01-09 21:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function Guenter Roeck <linux@roeck-us.net> - 2017-01-04 04:30 +0100
    Re: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in  probe function Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 20:40 +0100
      Re: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in  probe function Guenter Roeck <linux@roeck-us.net> - 2017-01-09 21:20 +0100

#1550411 — [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-04 04:30 +0100
Subject[PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function
Message-ID<sVKqZ-7ps-5@gated-at.bofh.it>
Checking if there is no error followed by a goto if there is one is
confusing. Reverse the logic.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/coh901327_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c
index a099b77fc0b9..dc97b2fd6c49 100644
--- a/drivers/watchdog/coh901327_wdt.c
+++ b/drivers/watchdog/coh901327_wdt.c
@@ -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:
-- 
2.7.4

[toc] | [next] | [standalone]


#1554639 — Re: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-01-09 20:40 +0100
SubjectRe: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function
Message-ID<sXNXs-8fG-19@gated-at.bofh.it>
In reply to#1550411
On Wed, Jan 4, 2017 at 4:25 AM, Guenter Roeck <linux@roeck-us.net> wrote:

> Checking if there is no error followed by a goto if there is one is
> confusing. Reverse the logic.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1554679 — Re: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-09 21:20 +0100
SubjectRe: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function
Message-ID<sXOAa-gv-17@gated-at.bofh.it>
In reply to#1554639
On Mon, Jan 09, 2017 at 08:38:03PM +0100, Linus Walleij wrote:
> On Wed, Jan 4, 2017 at 4:25 AM, Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > Checking if there is no error followed by a goto if there is one is
> > confusing. Reverse the logic.
> >
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
Thanks!

Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web