[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1153416317.11873.22.camel@hemera>
Date: Thu, 20 Jul 2006 19:25:16 +0200
From: Panagiotis Issaris <takis@....org>
To: "Daniel K." <daniel@...ded.net>
Cc: Panagiotis Issaris <takis@...umba.uhasselt.be>,
linux-kernel@...r.kernel.org, len.brown@...el.com,
chas@....nrl.navy.mil, miquel@...uba.ar, kkeil@...e.de,
benh@...nel.crashing.org, video4linux-list@...hat.com,
rmk+mmc@....linux.org.uk, Neela.Kolli@...enio.com,
jgarzik@...ox.com, vandrove@...cvut.cz, adaplas@....net,
thomas@...ischhofer.net, weissg@...nna.at, philb@....org,
linux-pcmcia@...ts.infradead.org, jkmaline@...hut.fi,
paulus@...ba.org
Subject: Re: [PATCH] drivers: Conversions from kmalloc+memset to
k(z|c)alloc.
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
-
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