From: Devendra Naga <devendra.aaru@gmail.com>
To: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>,
Wim Van sebroeck <wim@iguana.be>,
linux-watchdog@vger.kernel.org
Cc: Devendra Naga <devendra.aaru@gmail.com>
Subject: [PATCH] watchdog: at32watchdog: use devm_kzalloc
Date: Sat, 3 Nov 2012 03:10:12 -0400 [thread overview]
Message-ID: <1351926612-8002-1-git-send-email-devendra.aaru@gmail.com> (raw)
use the devm_kzalloc and no need of error path free's
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
drivers/watchdog/at32ap700x_wdt.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index 2896430..dc2e312 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -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;
--
1.7.10.4
reply other threads:[~2012-11-03 7:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351926612-8002-1-git-send-email-devendra.aaru@gmail.com \
--to=devendra.aaru@gmail.com \
--cc=hans-christian.egtvedt@atmel.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).