On Fri, 2010-07-09 at 16:20 +0300, Artem Bityutskiy wrote: > From: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx> > > This patch fixes the following problem indicated by kmemleak: > > kmemleak: unreferenced object 0xdf93c280 (size 64): > kmemleak: backtrace: > kmemleak: [<c00df6d4>] create_object+0x104/0x200 > kmemleak: [<c00d7638>] kmem_cache_alloc+0xe4/0xf4 > kmemleak: [<c000fc38>] omap_devinit_smartreflex+0x44/0x244 > kmemleak: [<c003a33c>] do_one_initcall+0x5c/0x1b8 > kmemleak: [<c00083fc>] kernel_init+0x94/0x110 > kmemleak: [<c003ba04>] kernel_thread_exit+0x0/0x8 > > The reason is that 'omap_devinit_smartreflex()' allocates 'sr_data', > then passes it to 'omap_device_build()', which 'kmemdup()'s it and > uses the copy. But 'omap_devinit_smartreflex()' never frees 'sr_data'. > > This patch make 'sr_data' to be a stack variable, which eliminates > the memory leak and simplifies the code a bit. > > Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx> > --- > arch/arm/mach-omap2/sr_device.c | 27 +++++++++------------------ > 1 files changed, 9 insertions(+), 18 deletions(-) Note, I only compile-tested both of the patches, so be careful. -- Best Regards, Artem Bityutskiy (Артём Битюцкий) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html