* Re: PATCH: Trivial kzalloc opportunity
2006-08-16 16:28 PATCH: Trivial kzalloc opportunity Alan Cox
@ 2006-08-16 16:15 ` Roland Dreier
2006-08-16 16:16 ` Arjan van de Ven
2006-08-16 16:41 ` Jeff Garzik
2 siblings, 0 replies; 4+ messages in thread
From: Roland Dreier @ 2006-08-16 16:15 UTC (permalink / raw)
To: Alan Cox; +Cc: akpm, linux-kernel
> + return (struct tty_struct *)kzalloc(sizeof(struct tty_struct), GFP_KERNEL);
Why the cast here? kzalloc() returns void *
- R.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: Trivial kzalloc opportunity
2006-08-16 16:28 PATCH: Trivial kzalloc opportunity Alan Cox
2006-08-16 16:15 ` Roland Dreier
@ 2006-08-16 16:16 ` Arjan van de Ven
2006-08-16 16:41 ` Jeff Garzik
2 siblings, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2006-08-16 16:16 UTC (permalink / raw)
To: Alan Cox; +Cc: akpm, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: Trivial kzalloc opportunity
@ 2006-08-16 16:28 Alan Cox
2006-08-16 16:15 ` Roland Dreier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alan Cox @ 2006-08-16 16:28 UTC (permalink / raw)
To: akpm, linux-kernel
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);
}
static void tty_buffer_free_all(struct tty_struct *);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: Trivial kzalloc opportunity
2006-08-16 16:28 PATCH: Trivial kzalloc opportunity Alan Cox
2006-08-16 16:15 ` Roland Dreier
2006-08-16 16:16 ` Arjan van de Ven
@ 2006-08-16 16:41 ` Jeff Garzik
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2006-08-16 16:41 UTC (permalink / raw)
To: Alan Cox; +Cc: akpm, linux-kernel
Alan Cox wrote:
> Signed-off-by: Alan Cox <alan@redhat.com>
Your subject line should include an indication of which part of the
kernel you are touching...
#1 of http://linux.yyz.us/patch-format.html
#2 of http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
#12 of Documentation/SubmittingPatches
Regards,
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-16 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-16 16:28 PATCH: Trivial kzalloc opportunity Alan Cox
2006-08-16 16:15 ` Roland Dreier
2006-08-16 16:16 ` Arjan van de Ven
2006-08-16 16:41 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox