Commit 47d17763 authored by Hans-Christian Egtvedt's avatar Hans-Christian Egtvedt Committed by Wim Van Sebroeck

[WATCHDOG] at32ap700x-wdt: add iounmap if probe function fails

Signed-off-by: default avatarHans-Christian Egtvedt <hcegtvedt@atmel.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent ff732316
...@@ -223,6 +223,11 @@ static int __init at32_wdt_probe(struct platform_device *pdev) ...@@ -223,6 +223,11 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
} }
wdt->regs = ioremap(regs->start, regs->end - regs->start + 1); 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->users = 0;
wdt->miscdev.minor = WATCHDOG_MINOR; wdt->miscdev.minor = WATCHDOG_MINOR;
wdt->miscdev.name = "watchdog"; wdt->miscdev.name = "watchdog";
...@@ -238,7 +243,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev) ...@@ -238,7 +243,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
ret = misc_register(&wdt->miscdev); ret = misc_register(&wdt->miscdev);
if (ret) { if (ret) {
dev_dbg(&pdev->dev, "failed to register wdt miscdev\n"); dev_dbg(&pdev->dev, "failed to register wdt miscdev\n");
goto err_register; goto err_iounmap;
} }
platform_set_drvdata(pdev, wdt); platform_set_drvdata(pdev, wdt);
...@@ -247,7 +252,9 @@ static int __init at32_wdt_probe(struct platform_device *pdev) ...@@ -247,7 +252,9 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
return 0; return 0;
err_register: err_iounmap:
iounmap(wdt->regs);
err_free:
kfree(wdt); kfree(wdt);
wdt = NULL; wdt = NULL;
return ret; return ret;
......
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