From: Boris BREZILLON <boris.brezillon@free-electrons.com>
To: "Gaël PORTAY" <gael.portay@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Thierry Reding <thierry.reding@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Subject: Re: [PATCH 1/3] ARM: at91/tclib: prefer using of devm_* functions
Date: Wed, 20 Aug 2014 10:19:46 +0200 [thread overview]
Message-ID: <20140820101946.3c894130@bbrezillon> (raw)
In-Reply-To: <1408486072-19268-2-git-send-email-gael.portay@gmail.com>
On Wed, 20 Aug 2014 00:07:50 +0200
Gaël PORTAY <gael.portay@gmail.com> wrote:
> 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;
>
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris BREZILLON)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: at91/tclib: prefer using of devm_* functions
Date: Wed, 20 Aug 2014 10:19:46 +0200 [thread overview]
Message-ID: <20140820101946.3c894130@bbrezillon> (raw)
In-Reply-To: <1408486072-19268-2-git-send-email-gael.portay@gmail.com>
On Wed, 20 Aug 2014 00:07:50 +0200
Ga?l PORTAY <gael.portay@gmail.com> wrote:
> 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;
>
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-08-20 8:19 UTC|newest]
Thread overview: 34+ 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
2014-08-19 22:07 ` [PATCH 1/3] ARM: at91/tclib: prefer using of devm_* functions Gaël PORTAY
2014-08-19 22:07 ` Gaël PORTAY
2014-08-20 8:19 ` Boris BREZILLON [this message]
2014-08-20 8:19 ` Boris BREZILLON
2014-08-19 22:07 ` [PATCH 2/3] ARM: at91/tclib: move initialization from alloc to probe Gaël PORTAY
2014-08-19 22:07 ` Gaël PORTAY
2014-08-20 7:39 ` Thierry Reding
2014-08-20 7:39 ` Thierry Reding
2014-08-20 8:16 ` Boris BREZILLON
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:07 ` Gaël PORTAY
2014-08-19 22:11 ` Jean-Christophe PLAGNIOL-VILLARD
2014-08-19 22:11 ` Jean-Christophe PLAGNIOL-VILLARD
2014-08-19 23:01 ` Boris BREZILLON
2014-08-19 23:01 ` Boris BREZILLON
2014-08-20 7:31 ` Thierry Reding
2014-08-20 7:31 ` Thierry Reding
2014-08-20 8:14 ` Boris BREZILLON
2014-08-20 8:14 ` Boris BREZILLON
2014-08-20 8:28 ` Thierry Reding
2014-08-20 8:28 ` Thierry Reding
2014-08-20 9:06 ` Boris BREZILLON
2014-08-20 9:06 ` Boris BREZILLON
2014-08-20 9:48 ` Thierry Reding
2014-08-20 9:48 ` Thierry Reding
2014-08-20 10:07 ` Boris BREZILLON
2014-08-20 10:07 ` Boris BREZILLON
2014-08-27 15:27 ` Gaël PORTAY
2014-08-21 3:32 ` Arnd Bergmann
2014-08-21 3:32 ` Arnd Bergmann
2014-08-21 9:43 ` Gaël PORTAY
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=20140820101946.3c894130@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=arnd@arndb.de \
--cc=daniel.lezcano@linaro.org \
--cc=gael.portay@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.