]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[WATCHDOG] at32ap700x-wdt: add iounmap if probe function fails
authorHans-Christian Egtvedt <hcegtvedt@atmel.com>
Fri, 8 Jun 2007 18:03:01 +0000 (11:03 -0700)
committerWim Van Sebroeck <wim@iguana.be>
Sun, 10 Jun 2007 20:11:42 +0000 (20:11 +0000)
Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/char/watchdog/at32ap700x_wdt.c

index a3e288701baffe0d03b8eb900ab8aaecc4d2cf23..745d38f25190b3b4c69d063038b6f1e77c72b6b5 100644 (file)
@@ -223,6 +223,11 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
        }
 
        wdt->regs = ioremap(regs->start, regs->end - regs->start + 1);
+       if (!wdt->regs) {
+               ret = -ENOMEM;
+               dev_dbg(&pdev->dev, "could not map I/O memory\n");
+               goto err_free;
+       }
        wdt->users = 0;
        wdt->miscdev.minor = WATCHDOG_MINOR;
        wdt->miscdev.name = "watchdog";
@@ -238,7 +243,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
        ret = misc_register(&wdt->miscdev);
        if (ret) {
                dev_dbg(&pdev->dev, "failed to register wdt miscdev\n");
-               goto err_register;
+               goto err_iounmap;
        }
 
        platform_set_drvdata(pdev, wdt);
@@ -247,7 +252,9 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
 
        return 0;
 
-err_register:
+err_iounmap:
+       iounmap(wdt->regs);
+err_free:
        kfree(wdt);
        wdt = NULL;
        return ret;