Re: [PATCH 2.6.20-rc3] TTY_IO: Remove unnecessary kmalloc casts

From: Rolf Eike Beer
Date: Fri Jan 05 2007 - 05:26:15 EST


Am Freitag, 5. Januar 2007 11:06 schrieb Ahmed S. Darwish:
> On Fri, Jan 05, 2007 at 09:10:01AM +0100, Rolf Eike Beer wrote:
> > Ahmed S. Darwish wrote:
> > > Remove unnecessary kmalloc casts in drivers/char/tty_io.c
> > >
> > > Signed-off-by: Ahmed Darwish <darwish.07@xxxxxxxxx>
> >
> > if (!*ltp_loc) {
> > - ltp = (struct ktermios *) kmalloc(sizeof(struct ktermios),
> > - GFP_KERNEL);
> > + ltp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
> > ^^^^^^^
> > if (!ltp)
> > goto free_mem_out;
> > memset(ltp, 0, sizeof(struct ktermios));
> > ^^^^^^
> > kzalloc
> >
> > if (!*o_ltp_loc) {
> > - o_ltp = (struct ktermios *)
> > - kmalloc(sizeof(struct ktermios), GFP_KERNEL);
> > + o_ltp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
> > ^^^^^^^
> > if (!o_ltp)
> > goto free_mem_out;
> > memset(o_ltp, 0, sizeof(struct ktermios));
> > ^^^^^^
> > kzalloc
>
> Currently I'm dropping this patch and writing a big patch to remove all the
> k[mzc]alloc castings in the 20-rc3 tree as suggested by Mr. Robert Day.

One big patch for the whole kernel will not work anyway. You have to split it
up to allow subsystems to integrate them in their own trees. With one big
patch you would get collisions all over the tree causing the complete patch
to get dropped. Also CC subsystem maintainers on their parts. And please send
the patches as replies to the first one as it cleans up readability of lkml a
lot :)

> I think this will be better done in another patch to let every patch do one
> single thing. right ?

Yes. But I would suggest starting with the kmalloc()->kzalloc() things. When
you do this conversions just remove the casts of the lines you're touching.
This will reduce the size of the complete thing avoiding two rather trivial
patches touching the same line twice.

Eike

Attachment: pgp00000.pgp
Description: PGP signature