mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 5/6] drivers/video/backlight/da9052_bl.c: drop devm_kfree of devm_kzalloc'd data
@ 2012-08-04 16:50 Julia Lawall
  2012-08-06  1:20 ` Jingoo Han
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-08-04 16:50 UTC (permalink / raw)
  To: Richard Purdie
  Cc: kernel-janitors, Florian Tobias Schandinat, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

devm_kfree should not have to be explicitly used.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,d;
@@

x = devm_kzalloc(...)
...
?-devm_kfree(d,x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/video/backlight/da9052_bl.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index b628d68..7c8626a 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -129,7 +129,6 @@ static int da9052_backlight_probe(struct platform_device *pdev)
 				       &da9052_backlight_ops, &props);
 	if (IS_ERR(bl)) {
 		dev_err(&pdev->dev, "Failed to register backlight\n");
-		devm_kfree(&pdev->dev, wleds);
 		return PTR_ERR(bl);
 	}
 
@@ -149,7 +148,6 @@ static int da9052_backlight_remove(struct platform_device *pdev)
 	wleds->state = DA9052_WLEDS_OFF;
 	da9052_adjust_wled_brightness(wleds);
 	backlight_device_unregister(bl);
-	devm_kfree(&pdev->dev, wleds);
 
 	return 0;
 }


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

* Re: [PATCH 5/6] drivers/video/backlight/da9052_bl.c: drop devm_kfree of devm_kzalloc'd data
  2012-08-04 16:50 [PATCH 5/6] drivers/video/backlight/da9052_bl.c: drop devm_kfree of devm_kzalloc'd data Julia Lawall
@ 2012-08-06  1:20 ` Jingoo Han
  0 siblings, 0 replies; 2+ messages in thread
From: Jingoo Han @ 2012-08-06  1:20 UTC (permalink / raw)
  To: 'Julia Lawall', 'Richard Purdie'
  Cc: kernel-janitors, 'Florian Tobias Schandinat',
	linux-fbdev, linux-kernel, 'Jingoo Han'

On Sunday, August 05, 2012 1:51 AM Julia Lawall wrote:
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> devm_kfree should not have to be explicitly used.
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x,d;
> @@
> 
> x = devm_kzalloc(...)
> ...
> ?-devm_kfree(d,x);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>


Acked-by: Jingoo Han <jg1.han@samsung.com>

It looks good.

Best regard,
Jingoo Han


> 
> ---
>  drivers/video/backlight/da9052_bl.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
> index b628d68..7c8626a 100644
> --- a/drivers/video/backlight/da9052_bl.c
> +++ b/drivers/video/backlight/da9052_bl.c
> @@ -129,7 +129,6 @@ static int da9052_backlight_probe(struct platform_device *pdev)
>  				       &da9052_backlight_ops, &props);
>  	if (IS_ERR(bl)) {
>  		dev_err(&pdev->dev, "Failed to register backlight\n");
> -		devm_kfree(&pdev->dev, wleds);
>  		return PTR_ERR(bl);
>  	}
> 
> @@ -149,7 +148,6 @@ static int da9052_backlight_remove(struct platform_device *pdev)
>  	wleds->state = DA9052_WLEDS_OFF;
>  	da9052_adjust_wled_brightness(wleds);
>  	backlight_device_unregister(bl);
> -	devm_kfree(&pdev->dev, wleds);
> 
>  	return 0;
>  }
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2012-08-06  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-04 16:50 [PATCH 5/6] drivers/video/backlight/da9052_bl.c: drop devm_kfree of devm_kzalloc'd data Julia Lawall
2012-08-06  1:20 ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®