diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2016-07-19 14:22:34 +0300 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2016-07-25 13:02:55 +0300 |
commit | 138913cb632be12344982e54ccd12f6f15971bf7 (patch) | |
tree | dbcb5044725b7e6d63e1a037f45726db449e8707 /drivers/watchdog | |
parent | cddd74db8d42b953a0612810f07c99e73deab185 (diff) | |
download | linux-138913cb632be12344982e54ccd12f6f15971bf7.tar.xz |
watchdog: core: Fix error handling of watchdog_dev_init()
Fix the error handling paths of watchdog_dev_init().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 270f4bf291e3..f128efc36135 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -972,17 +972,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; } /* |