Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: <linux-omap@vger.kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>, <mpm@selenic.com>,
	<herbert@gondor.hengli.com.au>, <dsaxena@plexity.net>,
	<linux-crypto@vger.kernel.org>, Lokesh Vutla <lokeshvutla@ti.com>
Subject: [PATCH 2/6] hwrng: OMAP: Convert to devm_kzalloc()
Date: Mon, 5 Aug 2013 20:17:19 +0530	[thread overview]
Message-ID: <1375714043-23407-3-git-send-email-lokeshvutla@ti.com> (raw)
In-Reply-To: <1375714043-23407-1-git-send-email-lokeshvutla@ti.com>

Use devm_kzalloc() to make cleanup paths simpler.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/char/hw_random/omap-rng.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 3e9a7ec..9c19396 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -109,7 +109,8 @@ static int omap_rng_probe(struct platform_device *pdev)
 	struct omap_rng_private_data *priv;
 	int ret;
 
-	priv = kzalloc(sizeof(struct omap_rng_private_data), GFP_KERNEL);
+	priv = devm_kzalloc(&pdev->dev, sizeof(struct omap_rng_private_data),
+			    GFP_KERNEL);
 	if (!priv) {
 		dev_err(&pdev->dev, "could not allocate memory\n");
 		return -ENOMEM;
@@ -144,8 +145,6 @@ err_register:
 	priv->base = NULL;
 	pm_runtime_disable(&pdev->dev);
 err_ioremap:
-	kfree(priv);
-
 	return ret;
 }
 
@@ -160,10 +159,6 @@ static int __exit omap_rng_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	release_mem_region(priv->mem_res->start, resource_size(priv->mem_res));
-
-	kfree(priv);
-
 	return 0;
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2013-08-05 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 14:47 [PATCH 0/6] hwrng: OMAP: Updates for OMAP RNG module Lokesh Vutla
2013-08-05 14:47 ` [PATCH 1/6] hwrng: OMAP: Use module_platform_driver macro Lokesh Vutla
2013-08-05 14:47 ` Lokesh Vutla [this message]
2013-08-05 14:47 ` [PATCH 3/6] hwrng: OMAP: Remove duplicated function call Lokesh Vutla
2013-08-05 14:47 ` [PATCH 4/6] hwrng: OMAP: Add device tree support Lokesh Vutla
2013-08-05 14:47 ` [PATCH 5/6] ARM: OMAP2+: Only manually add hwmod data when DT not used Lokesh Vutla
2013-08-05 14:47 ` [PATCH 6/6] hwrng: OMAP: Add OMAP4 TRNG support Lokesh Vutla
2013-08-09  6:42 ` [PATCH 0/6] hwrng: OMAP: Updates for OMAP RNG module Herbert Xu

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=1375714043-23407-3-git-send-email-lokeshvutla@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=dsaxena@plexity.net \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mpm@selenic.com \
    /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