linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups
@ 2018-04-02 16:49 Suman Anna
  2018-04-02 16:49 ` [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value Suman Anna
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Suman Anna @ 2018-04-02 16:49 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap,
	linux-kernel, Suman Anna

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value
  2018-04-02 16:49 [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups Suman Anna
@ 2018-04-02 16:49 ` 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-05-18 15:07 ` [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups Suman Anna
  2 siblings, 1 reply; 8+ messages in thread
From: Suman Anna @ 2018-04-02 16:49 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap,
	linux-kernel, Suman Anna, Zumeng Chen, stable

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 <zumeng.chen@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Suman Anna <s-anna@ti.com>
---
 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe()
  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-02 16:49 ` Suman Anna
  2018-04-03  4:22   ` Viresh Kumar
  2018-05-18 15:07 ` [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups Suman Anna
  2 siblings, 1 reply; 8+ messages in thread
From: Suman Anna @ 2018-04-02 16:49 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap,
	linux-kernel, Suman Anna, Zumeng Chen

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;
 }
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] cpufreq: ti-cpufreq: Fix an incorrect error return value
  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
  0 siblings, 0 replies; 8+ messages in thread
From: Viresh Kumar @ 2018-04-03  4:20 UTC (permalink / raw)
  To: Suman Anna
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap,
	linux-kernel, Zumeng Chen, stable

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 <zumeng.chen@gmail.com>
> Cc: stable@vger.kernel.org

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

Cc: 3.15+ <stable@vger.kernel.org> # v3.15+

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

> Signed-off-by: Suman Anna <s-anna@ti.com>
> ---
>  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 <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe()
  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
  0 siblings, 0 replies; 8+ messages in thread
From: Viresh Kumar @ 2018-04-03  4:22 UTC (permalink / raw)
  To: Suman Anna
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap,
	linux-kernel, Zumeng Chen

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups
  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-02 16:49 ` [PATCH v2 2/2] cpufreq: ti-cpufreq: Use devres managed API in probe() Suman Anna
@ 2018-05-18 15:07 ` Suman Anna
  2018-05-18 20:19   ` Rafael J. Wysocki
  2 siblings, 1 reply; 8+ messages in thread
From: Suman Anna @ 2018-05-18 15:07 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Dave Gerlach, Tero Kristo, linux-omap, linux-kernel

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(-)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2018-05-18 20:19 UTC (permalink / raw)
  To: Suman Anna
  Cc: Viresh Kumar, Dave Gerlach, Tero Kristo, linux-omap, linux-kernel

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 linux-pm@vger.kernel.org on
the submission.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] ti-cpufreq: minor fixes/cleanups
  2018-05-18 20:19   ` Rafael J. Wysocki
@ 2018-05-31 22:29     ` Suman Anna
  0 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2018-05-31 22:29 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Viresh Kumar, Dave Gerlach, Tero Kristo, linux-omap, linux-kernel

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 linux-pm@vger.kernel.org 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-31 22:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).