From: Guenter Roeck <linux@roeck-us.net>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Wim Van Sebroeck <wim@iguana.be>,
linux-arm-kernel@lists.infradead.org,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function
Date: Tue, 3 Jan 2017 19:25:40 -0800 [thread overview]
Message-ID: <1483500343-27113-1-git-send-email-linux@roeck-us.net> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function
Date: Tue, 3 Jan 2017 19:25:40 -0800 [thread overview]
Message-ID: <1483500343-27113-1-git-send-email-linux@roeck-us.net> (raw)
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
next reply other threads:[~2017-01-04 3:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 3:25 Guenter Roeck [this message]
2017-01-04 3:25 ` [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function Guenter Roeck
2017-01-04 3:25 ` [PATCH 2/4] watchdog: coh901327_wdt: Keep clock enabled after loading driver Guenter Roeck
2017-01-04 3:25 ` Guenter Roeck
2017-01-09 19:38 ` Linus Walleij
2017-01-09 19:38 ` Linus Walleij
2017-01-04 3:25 ` [PATCH 3/4] watchdog: coh901327_wdt: Use devm_ioremap_resource to map resources Guenter Roeck
2017-01-04 3:25 ` Guenter Roeck
2017-01-09 19:39 ` Linus Walleij
2017-01-09 19:39 ` Linus Walleij
2017-01-04 3:25 ` [PATCH 4/4] watchdog: coh901327_wdt: Use dev variable instead of pdev->dev Guenter Roeck
2017-01-04 3:25 ` Guenter Roeck
2017-01-09 19:39 ` Linus Walleij
2017-01-09 19:39 ` Linus Walleij
2017-01-09 19:38 ` [PATCH 1/4] watchdog: coh901327_wdt: Simplify error handling in probe function Linus Walleij
2017-01-09 19:38 ` Linus Walleij
2017-01-09 20:17 ` Guenter Roeck
2017-01-09 20:17 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1483500343-27113-1-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.