[PATCH] drivers: Conversions from kmalloc+memset to k(z|c)alloc.
Panagiotis Issaris
takis at gna.org
Thu Jul 20 13:25:16 EDT 2006
Hi,
On wo, 2006-07-19 at 02:40 +0000, Daniel K. wrote:
> > [...]
> > diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
> > index 4df6ab2..593940f 100644
> > --- a/drivers/char/rio/riocmd.c
> > +++ b/drivers/char/rio/riocmd.c
> > @@ -556,9 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void)
> > {
> > struct CmdBlk *CmdBlkP;
> >
> > - CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
> > - if (CmdBlkP)
> > - memset(CmdBlkP, 0, sizeof(struct CmdBlk));
> > + CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
> > return CmdBlkP;
> > }
> >
>
> Why not return kzalloc(...) here? Alternatively, return (type *) kzalloc(...),
> if you believe in explicit type casting of void pointers.
I figured someone might want to add extra code in f.e. RIOGetCmddBlk to
be able to debug/modify memory allocation behavior for the RIO driver
only. It does look a bit messy though. So I've updated it in my updated
patch.
Cheers,
Takis
More information about the linux-pcmcia
mailing list