kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx
@ 2015-06-08  9:37 Firo Yang
  2015-06-08  9:42 ` Firo Yang
  2015-06-08  9:45 ` Firo Yang
  0 siblings, 2 replies; 4+ messages in thread
From: Firo Yang @ 2015-06-08  9:37 UTC (permalink / raw)
  To: davem
  Cc: alexander.duyck, eric.dumazet, wharms, julia.lawall, kuznet,
	jmorris, yoshfuji, kaber, kernel-janitors, netdev, Firo Yang

A Coccinelle warning.
It's not necessary to free memory allocated with devm_xxx
and using these free functions maybe lead to a double free that
will corrupt the resource subsys. So, I just remove them.

Signed-off-by: Firo Yang <firogm@gmail.com>
---
In "[PATCH] ARM: pxa: ssp: remove unnessary free for devm_xxx", 
I forgot to remove an unused variable struct resource *res.

 arch/arm/plat-pxa/ssp.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index ad9529c..2b92a3b 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -232,25 +232,16 @@ static int pxa_ssp_probe(struct platform_device *pdev)
 
 static int pxa_ssp_remove(struct platform_device *pdev)
 {
-	struct resource *res;
 	struct ssp_device *ssp;
 
 	ssp = platform_get_drvdata(pdev);
 	if (ssp = NULL)
 		return -ENODEV;
 
-	iounmap(ssp->mmio_base);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, resource_size(res));
-
-	clk_put(ssp->clk);
-
 	mutex_lock(&ssp_lock);
 	list_del(&ssp->node);
 	mutex_unlock(&ssp_lock);
 
-	kfree(ssp);
 	return 0;
 }
 
-- 
2.4.2


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

* Re: [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx
  2015-06-08  9:37 [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx Firo Yang
@ 2015-06-08  9:42 ` Firo Yang
  2015-06-08  9:45 ` Firo Yang
  1 sibling, 0 replies; 4+ messages in thread
From: Firo Yang @ 2015-06-08  9:42 UTC (permalink / raw)
  To: davem
  Cc: alexander.duyck, eric.dumazet, wharms, julia.lawall, kuznet,
	jmorris, yoshfuji, kaber, kernel-janitors, netdev

Sorry, please, ignore this patch.
I send it to the wrong receiver.

On Mon, Jun 08, 2015 at 05:37:10PM +0800, Firo Yang wrote:
>A Coccinelle warning.
>It's not necessary to free memory allocated with devm_xxx
>and using these free functions maybe lead to a double free that
>will corrupt the resource subsys. So, I just remove them.
>
>Signed-off-by: Firo Yang <firogm@gmail.com>
>---
>In "[PATCH] ARM: pxa: ssp: remove unnessary free for devm_xxx", 
>I forgot to remove an unused variable struct resource *res.
>
> arch/arm/plat-pxa/ssp.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
>diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
>index ad9529c..2b92a3b 100644
>--- a/arch/arm/plat-pxa/ssp.c
>+++ b/arch/arm/plat-pxa/ssp.c
>@@ -232,25 +232,16 @@ static int pxa_ssp_probe(struct platform_device *pdev)
> 
> static int pxa_ssp_remove(struct platform_device *pdev)
> {
>-	struct resource *res;
> 	struct ssp_device *ssp;
> 
> 	ssp = platform_get_drvdata(pdev);
> 	if (ssp = NULL)
> 		return -ENODEV;
> 
>-	iounmap(ssp->mmio_base);
>-
>-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>-	release_mem_region(res->start, resource_size(res));
>-
>-	clk_put(ssp->clk);
>-
> 	mutex_lock(&ssp_lock);
> 	list_del(&ssp->node);
> 	mutex_unlock(&ssp_lock);
> 
>-	kfree(ssp);
> 	return 0;
> }
> 
>-- 
>2.4.2
>

-- 

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

* [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx
  2015-06-08  9:37 [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx Firo Yang
  2015-06-08  9:42 ` Firo Yang
@ 2015-06-08  9:45 ` Firo Yang
  2015-06-08  9:49   ` Daniel Mack
  1 sibling, 1 reply; 4+ messages in thread
From: Firo Yang @ 2015-06-08  9:45 UTC (permalink / raw)
  To: linux-arm-kernel

A Coccinelle warning.
It's not necessary to free memory allocated with devm_xxx
and using these free functions maybe lead to a double free that
will corrupt the resource subsys. So, I just remove them.

Signed-off-by: Firo Yang <firogm@gmail.com>
---
In "[PATCH] ARM: pxa: ssp: remove unnessary free for devm_xxx", 
I forgot to remove an unused variable struct resource *res.

 arch/arm/plat-pxa/ssp.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index ad9529c..2b92a3b 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -232,25 +232,16 @@ static int pxa_ssp_probe(struct platform_device *pdev)
 
 static int pxa_ssp_remove(struct platform_device *pdev)
 {
-	struct resource *res;
 	struct ssp_device *ssp;
 
 	ssp = platform_get_drvdata(pdev);
 	if (ssp = NULL)
 		return -ENODEV;
 
-	iounmap(ssp->mmio_base);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, resource_size(res));
-
-	clk_put(ssp->clk);
-
 	mutex_lock(&ssp_lock);
 	list_del(&ssp->node);
 	mutex_unlock(&ssp_lock);
 
-	kfree(ssp);
 	return 0;
 }
 
-- 
2.4.2


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

* Re: [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx
  2015-06-08  9:45 ` Firo Yang
@ 2015-06-08  9:49   ` Daniel Mack
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2015-06-08  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/08/2015 11:45 AM, Firo Yang wrote:
> A Coccinelle warning.
> It's not necessary to free memory allocated with devm_xxx
> and using these free functions maybe lead to a double free that
> will corrupt the resource subsys. So, I just remove them.
> 
> Signed-off-by: Firo Yang <firogm@gmail.com>

Reviewed-by: Daniel Mack <daniel@zonque.org>


Thanks!
Daniel


> ---
> In "[PATCH] ARM: pxa: ssp: remove unnessary free for devm_xxx", 
> I forgot to remove an unused variable struct resource *res.
> 
>  arch/arm/plat-pxa/ssp.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
> index ad9529c..2b92a3b 100644
> --- a/arch/arm/plat-pxa/ssp.c
> +++ b/arch/arm/plat-pxa/ssp.c
> @@ -232,25 +232,16 @@ static int pxa_ssp_probe(struct platform_device *pdev)
>  
>  static int pxa_ssp_remove(struct platform_device *pdev)
>  {
> -	struct resource *res;
>  	struct ssp_device *ssp;
>  
>  	ssp = platform_get_drvdata(pdev);
>  	if (ssp = NULL)
>  		return -ENODEV;
>  
> -	iounmap(ssp->mmio_base);
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	release_mem_region(res->start, resource_size(res));
> -
> -	clk_put(ssp->clk);
> -
>  	mutex_lock(&ssp_lock);
>  	list_del(&ssp->node);
>  	mutex_unlock(&ssp_lock);
>  
> -	kfree(ssp);
>  	return 0;
>  }
>  
> 


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

end of thread, other threads:[~2015-06-08  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-08  9:37 [PATCH v3] ARM: pxa: ssp: remove unnessary free for devm_xxx Firo Yang
2015-06-08  9:42 ` Firo Yang
2015-06-08  9:45 ` Firo Yang
2015-06-08  9:49   ` Daniel Mack

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