lkml.org 
[lkml]   [2006]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: + tty-trivial-kzalloc-opportunity.patch added to -mm tree
On 16/08/06, akpm@osdl.org <akpm@osdl.org> wrote:
>
> The patch titled
>
> tty: trivial kzalloc opportunity
>
> has been added to the -mm tree. Its filename is
>
> tty-trivial-kzalloc-opportunity.patch
>
> See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> out what to do about this
>
> ------------------------------------------------------
> Subject: tty: trivial kzalloc opportunity
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
>
> Signed-off-by: Alan Cox <alan@redhat.com>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> drivers/char/tty_io.c | 8 +-------
> 1 files changed, 1 insertion(+), 7 deletions(-)
>
> diff -puN drivers/char/tty_io.c~tty-trivial-kzalloc-opportunity drivers/char/tty_io.c
> --- a/drivers/char/tty_io.c~tty-trivial-kzalloc-opportunity
> +++ a/drivers/char/tty_io.c
> @@ -160,17 +160,11 @@ static void release_mem(struct tty_struc
> * been initialized in any way but has been zeroed
> *
> * Locking: none
> - * FIXME: use kzalloc
> */
>
> static struct tty_struct *alloc_tty_struct(void)
> {
> - struct tty_struct *tty;
> -
> - tty = kmalloc(sizeof(struct tty_struct), GFP_KERNEL);
> - if (tty)
> - memset(tty, 0, sizeof(struct tty_struct));
> - return tty;
> + return (struct tty_struct *)kzalloc(sizeof(struct tty_struct), GFP_KERNEL);
> }
Let's get rid of the typecast - eh?
Might as well also make the function inline given that all that's left
of it is a single call to kzalloc() - and why not simply replace all
calls to this function with a call to kzalloc()?

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-08-16 23:55    [W:2.395 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site