summaryrefslogtreecommitdiff
path: root/drivers/watchdog/sb_wdog.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-08-21 18:27:50 +0900
committerWim Van Sebroeck <wim@iguana.be>2010-09-15 18:43:47 +0000
commitae44855ae8b36e4194a0a43eec6351e81f880955 (patch)
tree2d47175a0562b8ea838ed98186a6b8e3fb5e14d1 /drivers/watchdog/sb_wdog.c
parent9c03f1622af051004416dd3e24d8a0fa31e34178 (diff)
watchdog: sb_wdog: release irq and reboot notifier in error path and module_exit()
irq and reboot notifier are acquired in module_init() but never released. They should be released correctly, otherwise reloading the module or error during module_init() will cause a problem. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Andrew Sharp <andy.sharp@lsi.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/sb_wdog.c')
-rw-r--r--drivers/watchdog/sb_wdog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 88c83aa57303..f31493e65b38 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -305,7 +305,7 @@ static int __init sbwdog_init(void)
if (ret) {
printk(KERN_ERR "%s: failed to request irq 1 - %d\n",
ident.identity, ret);
- return ret;
+ goto out;
}
ret = misc_register(&sbwdog_miscdev);
@@ -313,14 +313,20 @@ static int __init sbwdog_init(void)
printk(KERN_INFO "%s: timeout is %ld.%ld secs\n",
ident.identity,
timeout / 1000000, (timeout / 100000) % 10);
- } else
- free_irq(1, (void *)user_dog);
+ return 0;
+ }
+ free_irq(1, (void *)user_dog);
+out:
+ unregister_reboot_notifier(&sbwdog_notifier);
+
return ret;
}
static void __exit sbwdog_exit(void)
{
misc_deregister(&sbwdog_miscdev);
+ free_irq(1, (void *)user_dog);
+ unregister_reboot_notifier(&sbwdog_notifier);
}
module_init(sbwdog_init);