lkml.org 
[lkml]   [2014]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: unisys: kmalloc/memset to kzalloc conversation
On Tue, Mar 18, 2014 at 01:17:25PM -0700, Joe Perches wrote:
> On Tue, 2014-03-18 at 21:07 +0100, Silvio F wrote:
> > This patch solves the Coccinelle warning: "kzalloc should be used
> > instead of kmalloc/memset"
> []
> > diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h
> []
> > @@ -190,10 +190,7 @@ struct chaninfo {
> > }
> >
> > #define ALLOC_CMDRSP(cmdrsp) { \
> > - cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC); \
> > - if (cmdrsp != NULL) { \
> > - memset(cmdrsp, 0, SIZEOF_CMDRSP); \
> > - } \
> > + cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); \
> > }
>
> It'd be nicer to get rid of this macro altogether
> and substitute kzalloc in the 3 places it's used.

Yes, that's the better thing to do overall.

thanks,

greg k-h


\
 
 \ /
  Last update: 2014-03-18 22:01    [W:0.153 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site