[WATCHDOG] misc_register patch

Make sure that we first do a register_reboot_notifier before we
do a misc_register. A misc_register opens the interface to
userspace and it's best to do this as the last action.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Wim Van Sebroeck
2007-12-26 20:32:51 +00:00
parent 01c785dcb4
commit c6cb13aead
7 changed files with 70 additions and 70 deletions
+5 -5
View File
@@ -231,17 +231,17 @@ static int __init scx200_wdt_init(void)
sema_init(&open_semaphore, 1);
r = misc_register(&scx200_wdt_miscdev);
r = register_reboot_notifier(&scx200_wdt_notifier);
if (r) {
printk(KERN_ERR NAME ": unable to register reboot notifier");
release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
return r;
}
r = register_reboot_notifier(&scx200_wdt_notifier);
r = misc_register(&scx200_wdt_miscdev);
if (r) {
printk(KERN_ERR NAME ": unable to register reboot notifier");
misc_deregister(&scx200_wdt_miscdev);
unregister_reboot_notifier(&scx200_wdt_notifier);
release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
return r;
@@ -252,8 +252,8 @@ static int __init scx200_wdt_init(void)
static void __exit scx200_wdt_cleanup(void)
{
unregister_reboot_notifier(&scx200_wdt_notifier);
misc_deregister(&scx200_wdt_miscdev);
unregister_reboot_notifier(&scx200_wdt_notifier);
release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
}