[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <A874F61F95741C4A9BA573A70FE3998F82E4BBCA@DQHE02.ent.ti.com>
Date: Fri, 12 Apr 2013 06:51:48 +0000
From: "Kim, Milo" <Milo.Kim@...com>
To: "wim@...ana.be" <wim@...ana.be>
CC: "linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] watchdog: fix cleanup device code on registration
Duplicate lines of code are moved to cleanup_dev section.
And it returns 0 explicitly in case of no error.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@...com>
---
drivers/watchdog/watchdog_dev.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 42bfc9a..37c2dcc 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -613,11 +613,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
if (err) {
pr_err("watchdog%d unable to add device %d:%d\n",
watchdog->id, MAJOR(watchdog_devt), watchdog->id);
- if (watchdog->id == 0) {
- misc_deregister(&watchdog_miscdev);
- old_wdd = NULL;
- }
- return err;
+ goto cleanup_dev;
}
/* Activate the watchdog automatically by the driver itself */
@@ -625,13 +621,17 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
err = watchdog_auto_start(watchdog);
if (err) {
cdev_del(&watchdog->cdev);
- if (watchdog->id == 0) {
- misc_deregister(&watchdog_miscdev);
- old_wdd = NULL;
- }
+ goto cleanup_dev;
}
}
+ return 0;
+
+cleanup_dev:
+ if (watchdog->id == 0) {
+ misc_deregister(&watchdog_miscdev);
+ old_wdd = NULL;
+ }
return err;
}
--
1.7.9.5
Best Regards,
Milo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists