lkml.org 
[lkml]   [2011]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mfd: Don't leak init_data in tps65910_i2c_probe
Hi Jesper,

On Sat, Jul 02, 2011 at 09:21:38PM +0200, Jesper Juhl wrote:
> There are a couple of situations where we leak init_data in
> drivers/mfd/tps65910.c:tps65910_i2c_probe() - this patch should take
> care of them.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/mfd/tps65910.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> Compile tested only.
>
> diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
> index 2229e66..0db62f4 100644
> --- a/drivers/mfd/tps65910.c
> +++ b/drivers/mfd/tps65910.c
> @@ -144,15 +144,17 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
> return -EINVAL;
>
> init_data = kzalloc(sizeof(struct tps65910_platform_data), GFP_KERNEL);
> - if (init_data == NULL)
> + if (!init_data)
This is not a memory leak fix. And I actually prefer the == NULL check.
Please remove the == NULL check replacement with !* and keep only the memory
leak fixing part.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/


\
 
 \ /
  Last update: 2011-07-04 19:35    [from the cache]
©2003-2011 Jasper Spaans