[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0701050513360.23145@localhost.localdomain>
Date: Fri, 5 Jan 2007 05:18:40 -0500 (EST)
From: "Robert P. J. Day" <rpjday@...dspring.com>
To: "Ahmed S. Darwish" <darwish.07@...il.com>
cc: Rolf Eike Beer <eike-kernel@...tec.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2.6.20-rc3] TTY_IO: Remove unnecessary kmalloc casts
On Fri, 5 Jan 2007, Ahmed S. Darwish wrote:
> 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@...il.com>
> >
> > 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. I think this will be better done in another patch to let
> every patch do one single thing. right ?
almost. as i've learned (the hard way), while each patch should
logically accomplish one thing, while you're there, you might as well
clean up other issues *at the same locations*.
in this case, as mr. beer suggests, you should also check if this
represents a kmalloc->kzalloc cleanup (there's lots of those), and
also see if you can replace one of these:
sizeof(struct blah)
with one of these:
sizeof(*blahptr)
according to the CodingStyle guide.
rday
p.s. just FYI, i have a patch that does most of this, but i was going
to hold off submitting it until 2.6.20 had arrived. but if you want
to take a shot at it, it's all yours.
-
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