[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Oct 2013 16:14:00 -0700
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "sangjung.woo" <sangjung.woo@...sung.com>,
Alessandro Rubini <rubini@...dd.com>,
Russell King <rmk+kernel@....linux.org.uk>,
rtc-linux@...glegroups.com, linux-kernel@...r.kernel.org,
Tejun Heo <tj@...nel.org>, Greg KH <greg@...ah.com>
Subject: Re: [PATCH] rtc: pl030: Use devm_kzalloc() instead of kmalloc()
On Thu, 2013-10-10 at 16:06 -0700, Andrew Morton wrote:
> On Tue, 08 Oct 2013 21:59:27 -0700 Joe Perches <joe@...ches.com> wrote:
>
> > I was a bit surprised to find there isn't a devm_kmalloc.
>
> Yes, the unconditional memset is silly. Especially when the
> function has a handy gfp_t and could be passed __GFP_ZERO.
>
> The comment says "managed kzalloc/kfree for device drivers, no kmalloc,
> always use kzalloc". There's no explanation for this - it looks like
> some ideological thing.
Try this patch instead:
https://lkml.org/lkml/2013/10/9/14
Yours has an unnecessary duplicate memset of the whole
block when __GFP_ZERO is passed when that's already
done by the kmalloc_track_caller allocator.
Also if __GFP_ZERO is not passed, you should still
zero the struct devres header.
--
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