[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>
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 67aed9f..238273c 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -377,18 +377,18 @@
timeout);
}
- rc = misc_register(&wdt_miscdev);
- if (rc) {
- printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
- wdt_miscdev.minor, rc);
- goto err_out;
- }
-
rc = register_reboot_notifier(&wdt_notifier);
if (rc) {
printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
rc);
- goto err_out_miscdev;
+ goto err_out;
+ }
+
+ rc = misc_register(&wdt_miscdev);
+ if (rc) {
+ printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+ wdt_miscdev.minor, rc);
+ goto err_out_reboot;
}
if (nowayout) {
@@ -399,8 +399,8 @@
timeout, nowayout);
return 0;
-err_out_miscdev:
- misc_deregister(&wdt_miscdev);
+err_out_reboot:
+ unregister_reboot_notifier(&wdt_notifier);
err_out:
pci_dev_put(alim7101_pmu);
return rc;