Re: [PATCHv1] driver core/platform: don't leak memory allocated fordma_mask

From: Greg Kroah-Hartman
Date: Mon Jan 13 2014 - 17:55:36 EST


On Mon, Jan 13, 2014 at 10:38:05PM +0100, Yann Droneaud wrote:
> If a dma_mask is provided as part of platform_device_info,
> platform_device_register_full() allocate memory for a u64
> using kmalloc().
>
> A comment in the code state that "[t]his memory isn't freed
> when the device is put".
>
> It's never a good thing to leak memory, but there's only very
> few users of platform_device_info's dma_mask, and those are mostly
> "static" devices that are not going to be plugged/unplugged.

Why haven't you cc:ed the author of that comment? He would be best to
evaluate if this patch is good enough or not.

And is leaking that memory really an issue? As you point out, these
aren't devices that are going to go away (I'd argue that no platform
device should ever be a removable device, but that's a longer
argument...)

Please resend and cc: all of the needed developers.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/