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: [PATCHv4 1/4] ARM: at91/tclib: prefer using of devm_* functions
Date: Sat,  6 Sep 2014 19:52:34 +0200	[thread overview]
Message-ID: <1410025957-5952-2-git-send-email-gael.portay@gmail.com> (raw)
In-Reply-To: <1410025957-5952-1-git-send-email-gael.portay@gmail.com>

Signed-off-by: Ga?l PORTAY <gael.portay@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.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-09-06 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-06 17:52 [PATCHv4 0/4] ARM: at91/tclib: fix segmentation fault Gaël PORTAY
2014-09-06 17:52 ` Gaël PORTAY [this message]
2014-09-06 17:52 ` [PATCHv4 2/4] ARM: at91/tclib: move initialization from alloc to probe Gaël PORTAY
2014-09-06 17:52 ` [PATCHv4 3/4] ARM: at91/tclib: mask interruptions at shutdown and probe Gaël PORTAY
2014-09-06 17:52 ` [PATCHv4 4/4] clocksource: tcb_clksrc: sanitize IRQ request Gaël PORTAY
2014-09-08 10:43 ` [PATCHv4 0/4] ARM: at91/tclib: fix segmentation fault Nicolas Ferre

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=1410025957-5952-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).