linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: gael.portay@gmail.com (Gaël PORTAY)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: at91/tclib: prefer using of devm_* functions
Date: Wed, 20 Aug 2014 00:07:50 +0200	[thread overview]
Message-ID: <1408486072-19268-2-git-send-email-gael.portay@gmail.com> (raw)
In-Reply-To: <1408486072-19268-1-git-send-email-gael.portay@gmail.com>

Signed-off-by: Ga?l PORTAY <gael.portay@gmail.com>
---
 drivers/misc/atmel_tclib.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index c8d8e38..b514a2d 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -150,17 +150,15 @@ static int __init tc_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return -EINVAL;
 
-	tc = kzalloc(sizeof(struct atmel_tc), GFP_KERNEL);
+	tc = devm_kzalloc(&pdev->dev, sizeof(struct atmel_tc), GFP_KERNEL);
 	if (!tc)
 		return -ENOMEM;
 
 	tc->pdev = pdev;
 
-	clk = clk_get(&pdev->dev, "t0_clk");
-	if (IS_ERR(clk)) {
-		kfree(tc);
-		return -EINVAL;
-	}
+	clk = devm_clk_get(&pdev->dev, "t0_clk");
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
 
 	/* Now take SoC information if available */
 	if (pdev->dev.of_node) {
@@ -171,10 +169,10 @@ static int __init tc_probe(struct platform_device *pdev)
 	}
 
 	tc->clk[0] = clk;
-	tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
+	tc->clk[1] = devm_clk_get(&pdev->dev, "t1_clk");
 	if (IS_ERR(tc->clk[1]))
 		tc->clk[1] = clk;
-	tc->clk[2] = clk_get(&pdev->dev, "t2_clk");
+	tc->clk[2] = devm_clk_get(&pdev->dev, "t2_clk");
 	if (IS_ERR(tc->clk[2]))
 		tc->clk[2] = clk;
 
-- 
1.9.3

  reply	other threads:[~2014-08-19 22:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 22:07 [PATCH 0/3] ARM: at91/tclib: fix segmentation fault Gaël PORTAY
2014-08-19 22:07 ` Gaël PORTAY [this message]
2014-08-20  8:19   ` [PATCH 1/3] ARM: at91/tclib: prefer using of devm_* functions Boris BREZILLON
2014-08-19 22:07 ` [PATCH 2/3] ARM: at91/tclib: move initialization from alloc to probe Gaël PORTAY
2014-08-20  7:39   ` Thierry Reding
2014-08-20  8:16   ` Boris BREZILLON
2014-08-19 22:07 ` [PATCH 3/3] ARM: at91/tclib: mask interruptions at shutdown and probe Gaël PORTAY
2014-08-19 22:11   ` Jean-Christophe PLAGNIOL-VILLARD
2014-08-19 23:01     ` Boris BREZILLON
2014-08-20  7:31       ` Thierry Reding
2014-08-20  8:14         ` Boris BREZILLON
2014-08-20  8:28           ` Thierry Reding
2014-08-20  9:06             ` Boris BREZILLON
2014-08-20  9:48               ` Thierry Reding
2014-08-20 10:07                 ` Boris BREZILLON
2014-08-21  3:32   ` Arnd Bergmann

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=1408486072-19268-2-git-send-email-gael.portay@gmail.com \
    --to=gael.portay@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).