linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remove explicit devm_kfree
@ 2014-08-15 15:26 Arjun Sreedharan
  2014-08-15 16:51 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Arjun Sreedharan @ 2014-08-15 15:26 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: lejun.zhu, linux-input, linux-kernel

Memory allocated with devm_kzalloc() is freed automatically when device
out of scope.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
 drivers/input/misc/soc_button_array.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 5a6334b..123e59f 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -131,7 +131,6 @@ soc_button_device_create(struct pnp_dev *pdev,
 err_free_pdev:
 	platform_device_put(pd);
 err_free_mem:
-	devm_kfree(&pdev->dev, gpio_keys_pdata);
 	return ERR_PTR(error);
 }
 
-- 
1.7.11.7


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

* Re: [PATCH] remove explicit devm_kfree
  2014-08-15 15:26 [PATCH] remove explicit devm_kfree Arjun Sreedharan
@ 2014-08-15 16:51 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2014-08-15 16:51 UTC (permalink / raw)
  To: Arjun Sreedharan; +Cc: lejun.zhu, linux-input, linux-kernel

On Fri, Aug 15, 2014 at 08:56:05PM +0530, Arjun Sreedharan wrote:
> Memory allocated with devm_kzalloc() is freed automatically when device
> out of scope.

But in this case the device does not necessarily goes "out of scope" and we
still want to release memory.

Thanks.

> 
> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
> ---
>  drivers/input/misc/soc_button_array.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
> index 5a6334b..123e59f 100644
> --- a/drivers/input/misc/soc_button_array.c
> +++ b/drivers/input/misc/soc_button_array.c
> @@ -131,7 +131,6 @@ soc_button_device_create(struct pnp_dev *pdev,
>  err_free_pdev:
>  	platform_device_put(pd);
>  err_free_mem:
> -	devm_kfree(&pdev->dev, gpio_keys_pdata);
>  	return ERR_PTR(error);
>  }
>  
> -- 
> 1.7.11.7
> 

-- 
Dmitry

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

end of thread, other threads:[~2014-08-15 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15 15:26 [PATCH] remove explicit devm_kfree Arjun Sreedharan
2014-08-15 16:51 ` Dmitry Torokhov

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