mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: PATCH: Trivial kzalloc opportunity
Date: Wed, 16 Aug 2006 18:16:28 +0200	[thread overview]
Message-ID: <1155744988.3023.51.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1155745728.24077.354.camel@localhost.localdomain>

On Wed, 2006-08-16 at 17:28 +0100, Alan Cox wrote:
> Signed-off-by: Alan Cox <alan@redhat.com>
> 
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc4-mm1/drivers/char/tty_io.c linux-2.6.18-rc4-mm1/drivers/char/tty_io.c
> --- linux.vanilla-2.6.18-rc4-mm1/drivers/char/tty_io.c	2006-08-15 15:40:16.000000000 +0100
> +++ linux-2.6.18-rc4-mm1/drivers/char/tty_io.c	2006-08-15 16:01:19.000000000 +0100
> @@ -160,17 +160,11 @@
>   *	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);
>  }
>  

makes you wonder why this function even exists... (and why there is a
typecast in it ;)



-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com


  parent reply	other threads:[~2006-08-16 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-16 16:28 Alan Cox
2006-08-16 16:15 ` Roland Dreier
2006-08-16 16:16 ` Arjan van de Ven [this message]
2006-08-16 16:41 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1155744988.3023.51.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®