From: Viresh Kumar <viresh.kumar@linaro.org>
To: Suman Anna <s-anna@ti.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Dave Gerlach <d-gerlach@ti.com>, Tero Kristo <t-kristo@ti.com>,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
Zumeng Chen <zumeng.chen@gmail.com>
Subject: Re: [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe()
Date: Tue, 3 Apr 2018 09:52:04 +0530 [thread overview]
Message-ID: <20180403042204.GH3572@vireshk-i7> (raw)
In-Reply-To: <20180402164958.20057-3-s-anna@ti.com>
On 02-04-18, 11:49, Suman Anna wrote:
> The ti_cpufreq_probe() function uses regular kzalloc to allocate
> the ti_cpufreq_data structure and kfree for freeing this memory
> on failures. Simplify this code by using the devres managed
> API.
>
> Cc: Zumeng Chen <zumeng.chen@gmail.com>
> Signed-off-by: Suman Anna <s-anna@ti.com>
> ---
> drivers/cpufreq/ti-cpufreq.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index 46d1ab2dea87..7d353a21935b 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -217,7 +217,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
> if (!match)
> return -ENODEV;
>
> - opp_data = kzalloc(sizeof(*opp_data), GFP_KERNEL);
> + opp_data = devm_kzalloc(&pdev->dev, sizeof(*opp_data), GFP_KERNEL);
> if (!opp_data)
> return -ENOMEM;
>
> @@ -226,8 +226,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
> opp_data->cpu_dev = get_cpu_device(0);
> if (!opp_data->cpu_dev) {
> pr_err("%s: Failed to get device for CPU0\n", __func__);
> - ret = -ENODEV;
> - goto free_opp_data;
> + return -ENODEV;
> }
>
> opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev);
> @@ -285,8 +284,6 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
>
> fail_put_node:
> of_node_put(opp_data->opp_node);
> -free_opp_data:
> - kfree(opp_data);
>
> return ret;
> }
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2018-04-03 4:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 16:49 [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups Suman Anna
2018-04-02 16:49 ` [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value Suman Anna
2018-04-03 4:20 ` Viresh Kumar
2018-04-02 16:49 ` [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe() Suman Anna
2018-04-03 4:22 ` Viresh Kumar [this message]
2018-05-18 15:07 ` [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups Suman Anna
2018-05-18 20:19 ` Rafael J. Wysocki
2018-05-31 22:29 ` Suman Anna
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=20180403042204.GH3572@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=d-gerlach@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=s-anna@ti.com \
--cc=t-kristo@ti.com \
--cc=zumeng.chen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox