From: Roel Kluin <roel.kluin@gmail.com>
To: Wim Van Sebroeck <wim@iguana.be>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] txx9wdt.c:52: Fix txx9wdt_probe() cleaning up after errors
Date: Tue, 25 Aug 2009 11:20:26 +0200 [thread overview]
Message-ID: <4A93ACDA.8030000@gmail.com> (raw)
Make txx9wdt_probe() clean up after errors.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Any comments?
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index 6adab77..1e15de3 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -212,25 +212,31 @@ static int __init txx9wdt_probe(struct platform_device *dev)
}
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!res)
- goto exit_busy;
+ if (!res) {
+ ret = -EBUSY;
+ goto exit;
+ }
if (!devm_request_mem_region(&dev->dev,
res->start, res->end - res->start + 1,
- "txx9wdt"))
- goto exit_busy;
+ "txx9wdt")) {
+ ret = -EBUSY;
+ goto exit;
+ }
txx9wdt_reg = devm_ioremap(&dev->dev,
res->start, res->end - res->start + 1);
- if (!txx9wdt_reg)
- goto exit_busy;
+ if (!txx9wdt_reg) {
+ ret = -EBUSY;
+ goto exit_release_mem;
+ }
ret = register_reboot_notifier(&txx9wdt_notifier);
if (ret)
- goto exit;
+ goto exit_iounmap;
ret = misc_register(&txx9wdt_miscdev);
if (ret) {
unregister_reboot_notifier(&txx9wdt_notifier);
- goto exit;
+ goto exit_iounmap;
}
printk(KERN_INFO "Hardware Watchdog Timer for TXx9: "
@@ -238,8 +244,11 @@ static int __init txx9wdt_probe(struct platform_device *dev)
timeout, WD_MAX_TIMEOUT, nowayout);
return 0;
-exit_busy:
- ret = -EBUSY;
+
+exit_iounmap:
+ devm_iounmap(&dev->dev, txx9wdt_reg);
+exit_release_mem:
+ devm_release_mem_region(&dev->dev, res->start, res->end - res->start + 1);
exit:
if (txx9_imclk) {
clk_disable(txx9_imclk);
next reply other threads:[~2009-08-25 9:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 9:20 Roel Kluin [this message]
2009-08-25 20:08 ` [PATCH] txx9wdt.c:52: Fix txx9wdt_probe() cleaning up after errors Wim Van Sebroeck
2009-08-27 14:52 ` Atsushi Nemoto
2009-08-27 20:13 ` Wim Van Sebroeck
2009-08-28 14:24 ` Atsushi Nemoto
2009-08-31 12:02 ` Wim Van Sebroeck
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=4A93ACDA.8030000@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox