Skip to content

Commit

Permalink
watchdog: sb_wdog: release irq and reboot notifier in error path and …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Akinobu Mita authored and Wim Van Sebroeck committed Sep 15, 2010
1 parent 9c03f16 commit ae44855
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/watchdog/sb_wdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,28 @@ 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);
if (ret == 0) {
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);
Expand Down

0 comments on commit ae44855

Please sign in to comment.