From: "Randy.Dunlap" <rddunlap@osdl.org>, Leann Ogasawara <ogasawara@osdl.org>

handle ioremap() failures in sc520_wdt.c


 25-akpm/drivers/char/watchdog/sc520_wdt.c |    7 +++++++
 1 files changed, 7 insertions(+)

diff -puN drivers/char/watchdog/sc520_wdt.c~sc520_wdt-ioremap-checking drivers/char/watchdog/sc520_wdt.c
--- 25/drivers/char/watchdog/sc520_wdt.c~sc520_wdt-ioremap-checking	Thu Sep  4 11:26:17 2003
+++ 25-akpm/drivers/char/watchdog/sc520_wdt.c	Thu Sep  4 11:26:17 2003
@@ -423,11 +423,18 @@ static int __init sc520_wdt_init(void)
 
 	wdtmrctl = (__u16 *)((char *)wdtmrctl + OFFS_WDTMRCTL);
 	wdtmrctl = ioremap((unsigned long)wdtmrctl, 2);
+	if (!wdtmrctl) {
+		printk (KERN_ERR PFX "Unable to remap memory.\n");
+		rc = -ENOMEM;
+		goto err_out_notifier;
+	}
 	printk(KERN_INFO PFX "WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n",
 		timeout,nowayout);
 
 	return 0;
 
+err_out_notifier:
+	unregister_reboot_notifier(&wdt_notifier);
 err_out_miscdev:
 	misc_deregister(&wdt_miscdev);
 err_out_region2:

_