Re: PATCH: Trivial kzalloc opportunity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-08-16 at 17:28 +0100, Alan Cox wrote:
> Signed-off-by: Alan Cox <[email protected]>
> 
> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux