Skip to content

Commit

Permalink
[WATCHDOG] at32ap700x-wdt: add iounmap if probe function fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans-Christian Egtvedt authored and Wim Van Sebroeck committed Jun 10, 2007
1 parent ff73231 commit 47d1776
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/char/watchdog/at32ap700x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 47d1776

Please sign in to comment.