Commit 271c62e5 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] ib700wdt janitor work

o Check misc_register return code
o request_region() return code checking
o graceful failure
parent 9becd657
...@@ -271,11 +271,21 @@ ibwdt_init(void) ...@@ -271,11 +271,21 @@ ibwdt_init(void)
ibwdt_validate_timeout(); ibwdt_validate_timeout();
spin_lock_init(&ibwdt_lock); spin_lock_init(&ibwdt_lock);
misc_register(&ibwdt_miscdev); if (misc_register(&ibwdt_miscdev))
return -ENODEV;
#if WDT_START != WDT_STOP #if WDT_START != WDT_STOP
request_region(WDT_STOP, 1, "IB700 WDT"); if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
misc_deregister(&ibwdt_miscdev);
return -EIO;
}
#endif
if (!request_region(WDT_START, 1, "IB700 WDT")) {
#if WDT_START != WDT_STOP
release_region(WDT_STOP, 1);
#endif #endif
request_region(WDT_START, 1, "IB700 WDT"); misc_deregister(&ibwdt_miscdev);
return -EIO;
}
register_reboot_notifier(&ibwdt_notifier); register_reboot_notifier(&ibwdt_notifier);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment