linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] watchdog: core: Fix error handling of watchdog_dev_init()
@ 2016-07-19 11:22 Wei Yongjun
  2016-07-19 14:33 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-07-19 11:22 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: Wei Yongjun, linux-watchdog

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix the error handling paths of watchdog_dev_init().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/watchdog/watchdog_dev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 14f8a92..f6e6751 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -952,17 +952,22 @@ int __init watchdog_dev_init(void)
 	err = class_register(&watchdog_class);
 	if (err < 0) {
 		pr_err("couldn't register class\n");
-		return err;
+		goto err_register;
 	}
 
 	err = alloc_chrdev_region(&watchdog_devt, 0, MAX_DOGS, "watchdog");
 	if (err < 0) {
 		pr_err("watchdog: unable to allocate char dev region\n");
-		class_unregister(&watchdog_class);
-		return err;
+		goto err_alloc;
 	}
 
 	return 0;
+
+err_alloc:
+	class_unregister(&watchdog_class);
+err_register:
+	destroy_workqueue(watchdog_wq);
+	return err;
 }
 
 /*



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-19 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 11:22 [PATCH -next] watchdog: core: Fix error handling of watchdog_dev_init() Wei Yongjun
2016-07-19 14:33 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).