kmemleak: remove memset by using kzalloc

We don't need to memset if we just use kzalloc() rather than kmalloc() in
kmemleak_test_init().

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
Jesper Juhl 2010-10-30 23:43:05 +02:00 committed by Catalin Marinas
parent 3c0eee3fe6
commit 0a08739e81
1 changed files with 2 additions and 4 deletions

View File

@ -75,13 +75,11 @@ static int __init kmemleak_test_init(void)
* after the module is removed. * after the module is removed.
*/ */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
elem = kmalloc(sizeof(*elem), GFP_KERNEL); elem = kzalloc(sizeof(*elem), GFP_KERNEL);
pr_info("kmemleak: kmalloc(sizeof(*elem)) = %p\n", elem); pr_info("kmemleak: kzalloc(sizeof(*elem)) = %p\n", elem);
if (!elem) if (!elem)
return -ENOMEM; return -ENOMEM;
memset(elem, 0, sizeof(*elem));
INIT_LIST_HEAD(&elem->list); INIT_LIST_HEAD(&elem->list);
list_add_tail(&elem->list, &test_list); list_add_tail(&elem->list, &test_list);
} }