2018-04-02 16:51:41

by Suman Anna

[permalink] [raw]
Subject: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups

Hi Viresh,

Please find the updated series replacing the previous patch [1] fixing
couple of issues in the TI CPUFreq driver. I have split up the patches
as per your comments on v1. Final code diff remains the same as before.

regards
Suman

[1] https://patchwork.kernel.org/patch/10308925/

Suman Anna (2):
cpufreq: ti-cpufreq: Fix an incorrect error return value
cpufreq: ti-cpufreq: Use devres managed API in probe()

drivers/cpufreq/ti-cpufreq.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

--
2.16.2



2018-04-02 16:51:42

by Suman Anna

[permalink] [raw]
Subject: [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe()

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 <[email protected]>
Signed-off-by: Suman Anna <[email protected]>
---
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;
}
--
2.16.2


2018-04-02 16:53:05

by Suman Anna

[permalink] [raw]
Subject: [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value

Commit 05829d9431df ("cpufreq: ti-cpufreq: kfree opp_data when
failure") has fixed a memory leak in the failure path, however
the patch returned a positive value on get_cpu_device() failure
instead of the previous negative value. Fix this incorrect error
return value properly.

Fixes: 05829d9431df ("cpufreq: ti-cpufreq: kfree opp_data when failure")
Cc: Zumeng Chen <[email protected]>
Cc: [email protected]
Signed-off-by: Suman Anna <[email protected]>
---
drivers/cpufreq/ti-cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index a099b7bf74cd..46d1ab2dea87 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -226,7 +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;
+ ret = -ENODEV;
goto free_opp_data;
}

--
2.16.2


2018-04-03 04:22:28

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value

On 02-04-18, 11:49, Suman Anna wrote:
> Commit 05829d9431df ("cpufreq: ti-cpufreq: kfree opp_data when
> failure") has fixed a memory leak in the failure path, however
> the patch returned a positive value on get_cpu_device() failure
> instead of the previous negative value. Fix this incorrect error
> return value properly.
>
> Fixes: 05829d9431df ("cpufreq: ti-cpufreq: kfree opp_data when failure")
> Cc: Zumeng Chen <[email protected]>
> Cc: [email protected]

You also need to mention which version of the stable kernel this patch
should be applied to, like this:

Cc: 3.15+ <[email protected]> # v3.15+

Rafael would probably fix this while applying, so no need to resend
again for now.

> Signed-off-by: Suman Anna <[email protected]>
> ---
> drivers/cpufreq/ti-cpufreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index a099b7bf74cd..46d1ab2dea87 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -226,7 +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;
> + ret = -ENODEV;
> goto free_opp_data;
> }

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2018-04-03 04:23:42

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe()

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 <[email protected]>
> Signed-off-by: Suman Anna <[email protected]>
> ---
> 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 <[email protected]>

--
viresh

2018-05-18 15:08:16

by Suman Anna

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups

On 04/02/2018 11:49 AM, Suman Anna wrote:
> Hi Viresh,
>
> Please find the updated series replacing the previous patch [1] fixing
> couple of issues in the TI CPUFreq driver. I have split up the patches
> as per your comments on v1. Final code diff remains the same as before.
>
> regards
> Suman
>
> [1] https://patchwork.kernel.org/patch/10308925/
>
> Suman Anna (2):
> cpufreq: ti-cpufreq: Fix an incorrect error return value
> cpufreq: ti-cpufreq: Use devres managed API in probe()

Gentle reminder, I don't see these patches in -next. Who is picking up
these patches?

regards
Suman

>
> drivers/cpufreq/ti-cpufreq.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>


2018-05-18 20:21:03

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups

On Friday, May 18, 2018 5:07:12 PM CEST Suman Anna wrote:
> On 04/02/2018 11:49 AM, Suman Anna wrote:
> > Hi Viresh,
> >
> > Please find the updated series replacing the previous patch [1] fixing
> > couple of issues in the TI CPUFreq driver. I have split up the patches
> > as per your comments on v1. Final code diff remains the same as before.
> >
> > regards
> > Suman
> >
> > [1] https://patchwork.kernel.org/patch/10308925/
> >
> > Suman Anna (2):
> > cpufreq: ti-cpufreq: Fix an incorrect error return value
> > cpufreq: ti-cpufreq: Use devres managed API in probe()
>
> Gentle reminder, I don't see these patches in -next. Who is picking up
> these patches?

You need to resend them I'm afraid, with any tags received so far.

And they won't be picked up if you don't CC [email protected] on
the submission.

Thanks,
Rafael


2018-05-31 22:30:08

by Suman Anna

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups

Hi Rafael,

On 05/18/2018 03:19 PM, Rafael J. Wysocki wrote:
> On Friday, May 18, 2018 5:07:12 PM CEST Suman Anna wrote:
>> On 04/02/2018 11:49 AM, Suman Anna wrote:
>>> Hi Viresh,
>>>
>>> Please find the updated series replacing the previous patch [1] fixing
>>> couple of issues in the TI CPUFreq driver. I have split up the patches
>>> as per your comments on v1. Final code diff remains the same as before.
>>>
>>> regards
>>> Suman
>>>
>>> [1] https://patchwork.kernel.org/patch/10308925/
>>>
>>> Suman Anna (2):
>>> cpufreq: ti-cpufreq: Fix an incorrect error return value
>>> cpufreq: ti-cpufreq: Use devres managed API in probe()
>>
>> Gentle reminder, I don't see these patches in -next. Who is picking up
>> these patches?
>
> You need to resend them I'm afraid, with any tags received so far.
>
> And they won't be picked up if you don't CC [email protected] on
> the submission.

Sorry for the delay, I have reposted the series with all the tags picked
up and CCing the linux-pm list.

regards
Suman