watchdog: at32watchdog: use devm_kzalloc
PATCH 1/1 watchdog: at32watchdog: use devm_kzalloc
use the devm_kzalloc and no need of error path free's
Signed-off-by Devendra Naga <[email protected]>
--- drivers/watchdog/at32ap700x_wdt.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/watchdog/at32ap700x_wdt.c +2 -8
@@ -321,7 +321,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)return -ENXIO ; } - wdt =kzalloc (sizeof (struct wdt_at32ap700x ),GFP_KERNEL ); + wdt =devm_kzalloc (&pdev->dev,sizeof (struct wdt_at32ap700x ),GFP_KERNEL );if (!wdt) {dev_dbg (&pdev->dev,"no memory for wdt structure\n" );return -ENOMEM ;
@@ -329,9 +329,8 @@ static int __init at32_wdt_probe(struct platform_device *pdev) wdt->regs =ioremap (regs->start,resource_size (regs));if (!wdt->regs) { - ret = -ENOMEM ;dev_dbg (&pdev->dev,"could not map I/O memory\n" ); - goto err_free; +return -ENOMEM ; }spin_lock_init (&wdt->io_lock);
@@ -377,9 +376,6 @@ err_register:platform_set_drvdata (pdev,NULL ); err_iounmap:iounmap (wdt->regs); -err_free: -kfree (wdt); - wdt =NULL ;return ret; }
@@ -392,8 +388,6 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)misc_deregister (&wdt->miscdev);iounmap (wdt->regs); -kfree (wdt); - wdt =NULL ;platform_set_drvdata (pdev,NULL ); }return 0 ;
Signature · 1 line
1.7.10.4