mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
watchdog: at32ap700x_wdt: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
6d128e1e72
commit
a7960784e9
1 changed files with 4 additions and 8 deletions
|
@ -321,13 +321,14 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
wdt = kzalloc(sizeof(struct wdt_at32ap700x), GFP_KERNEL);
|
wdt = devm_kzalloc(&pdev->dev, sizeof(struct wdt_at32ap700x),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!wdt) {
|
if (!wdt) {
|
||||||
dev_dbg(&pdev->dev, "no memory for wdt structure\n");
|
dev_dbg(&pdev->dev, "no memory for wdt structure\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
wdt->regs = ioremap(regs->start, resource_size(regs));
|
wdt->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
|
||||||
if (!wdt->regs) {
|
if (!wdt->regs) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
dev_dbg(&pdev->dev, "could not map I/O memory\n");
|
dev_dbg(&pdev->dev, "could not map I/O memory\n");
|
||||||
|
@ -342,7 +343,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||||
dev_info(&pdev->dev, "CPU must be reset with external "
|
dev_info(&pdev->dev, "CPU must be reset with external "
|
||||||
"reset or POR due to silicon errata.\n");
|
"reset or POR due to silicon errata.\n");
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto err_iounmap;
|
goto err_free;
|
||||||
} else {
|
} else {
|
||||||
wdt->users = 0;
|
wdt->users = 0;
|
||||||
}
|
}
|
||||||
|
@ -375,10 +376,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
err_register:
|
err_register:
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
err_iounmap:
|
|
||||||
iounmap(wdt->regs);
|
|
||||||
err_free:
|
err_free:
|
||||||
kfree(wdt);
|
|
||||||
wdt = NULL;
|
wdt = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -391,8 +389,6 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)
|
||||||
at32_wdt_stop();
|
at32_wdt_stop();
|
||||||
|
|
||||||
misc_deregister(&wdt->miscdev);
|
misc_deregister(&wdt->miscdev);
|
||||||
iounmap(wdt->regs);
|
|
||||||
kfree(wdt);
|
|
||||||
wdt = NULL;
|
wdt = NULL;
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue