[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTikQjH5pdenTNRxyBwegbkRj0vGHLg@mail.gmail.com>
Date: Tue, 24 May 2011 22:59:33 +0600
From: Rakib Mullick <rakib.mullick@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] drivers: Use kzalloc instead of 'kmalloc+memset', where possible.
On 5/23/11, Joe Perches <joe@...ches.com> wrote:
> On Mon, 2011-05-23 at 23:40 +0600, Rakib Mullick wrote:
>> Following patch removes the uses of 'kmalloc+memset' from various
>> drivers subsystems, which is replaced by kzalloc. kzalloc take care of
>> setting allocated memory with null, so it helps to get rid from using
>> memset.
>> diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
> []
>> - entry->pagelist = kmalloc(pages * sizeof(*entry->pagelist), GFP_KERNEL);
>> + entry->pagelist = kzalloc(pages * sizeof(*entry->pagelist), GFP_KERNEL);
>
> Perhaps it's better to use:
>
> entry->pagelist = kcalloc(pages, sizeof(*entry->pagelist), GFP_KERNEL);
>
>> - entry->busaddr = kmalloc(pages * sizeof(*entry->busaddr), GFP_KERNEL);
>> + entry->busaddr = kzalloc(pages * sizeof(*entry->busaddr), GFP_KERNEL);
>
> here too.
>
Is there any significant benefit of using kcalloc here?
Thanks,
Rakib
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists