diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2006-12-13 03:35:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:58 -0500 |
commit | 5cbded585d129d0226cb48ac4202b253c781be26 (patch) | |
tree | fb24edc194a57ee81a3bf8a4dd8a95030dd0ad22 /drivers/char | |
parent | 0743b86800cf1dfbf96df4a438938127bbe4476c (diff) |
[PATCH] getting rid of all casts of k[cmz]alloc() calls
Run this:
#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done
And then go through and reinstate those cases where code is casting pointers
to non-pointers.
And then drop a few hunks which conflicted with outstanding work.
Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/consolemap.c | 2 | ||||
-rw-r--r-- | drivers/char/lcd.c | 2 | ||||
-rw-r--r-- | drivers/char/lp.c | 2 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 2 | ||||
-rw-r--r-- | drivers/char/rio/riocmd.c | 2 | ||||
-rw-r--r-- | drivers/char/synclink.c | 2 | ||||
-rw-r--r-- | drivers/char/synclinkmp.c | 4 | ||||
-rw-r--r-- | drivers/char/vt.c | 2 | ||||
-rw-r--r-- | drivers/char/vt_ioctl.c | 4 |
9 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c index 04a12027a740..b99b7561260d 100644 --- a/drivers/char/consolemap.c +++ b/drivers/char/consolemap.c | |||
@@ -443,7 +443,7 @@ int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui) | |||
443 | p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; | 443 | p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; |
444 | if (p && p->readonly) return -EIO; | 444 | if (p && p->readonly) return -EIO; |
445 | if (!p || --p->refcount) { | 445 | if (!p || --p->refcount) { |
446 | q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL); | 446 | q = kmalloc(sizeof(*p), GFP_KERNEL); |
447 | if (!q) { | 447 | if (!q) { |
448 | if (p) p->refcount++; | 448 | if (p) p->refcount++; |
449 | return -ENOMEM; | 449 | return -ENOMEM; |
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index da601fd6c07a..d649abbf0857 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
@@ -459,7 +459,7 @@ static int lcd_ioctl(struct inode *inode, struct file *file, | |||
459 | (&display, (struct lcd_display *) arg, | 459 | (&display, (struct lcd_display *) arg, |
460 | sizeof(struct lcd_display))) | 460 | sizeof(struct lcd_display))) |
461 | return -EFAULT; | 461 | return -EFAULT; |
462 | rom = (unsigned char *) kmalloc((128), GFP_ATOMIC); | 462 | rom = kmalloc((128), GFP_ATOMIC); |
463 | if (rom == NULL) { | 463 | if (rom == NULL) { |
464 | printk(KERN_ERR LCD "kmalloc() failed in %s\n", | 464 | printk(KERN_ERR LCD "kmalloc() failed in %s\n", |
465 | __FUNCTION__); | 465 | __FUNCTION__); |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index b70b5388b5a8..b51d08be0bcf 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -525,7 +525,7 @@ static int lp_open(struct inode * inode, struct file * file) | |||
525 | return -EIO; | 525 | return -EIO; |
526 | } | 526 | } |
527 | } | 527 | } |
528 | lp_table[minor].lp_buffer = (char *) kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); | 528 | lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); |
529 | if (!lp_table[minor].lp_buffer) { | 529 | if (!lp_table[minor].lp_buffer) { |
530 | LP_F(minor) &= ~LP_BUSY; | 530 | LP_F(minor) &= ~LP_BUSY; |
531 | return -ENOMEM; | 531 | return -ENOMEM; |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 5152cedd8878..f108c136800a 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -541,7 +541,7 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
541 | if (debug_level >= DEBUG_LEVEL_INFO) | 541 | if (debug_level >= DEBUG_LEVEL_INFO) |
542 | printk("mgslpc_attach\n"); | 542 | printk("mgslpc_attach\n"); |
543 | 543 | ||
544 | info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); | 544 | info = kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); |
545 | if (!info) { | 545 | if (!info) { |
546 | printk("Error can't allocate device instance data\n"); | 546 | printk("Error can't allocate device instance data\n"); |
547 | return -ENOMEM; | 547 | return -ENOMEM; |
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 167ebc84e8d7..245f03195b7c 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -556,7 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void) | |||
556 | { | 556 | { |
557 | struct CmdBlk *CmdBlkP; | 557 | struct CmdBlk *CmdBlkP; |
558 | 558 | ||
559 | CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); | 559 | CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); |
560 | if (CmdBlkP) | 560 | if (CmdBlkP) |
561 | memset(CmdBlkP, 0, sizeof(struct CmdBlk)); | 561 | memset(CmdBlkP, 0, sizeof(struct CmdBlk)); |
562 | return CmdBlkP; | 562 | return CmdBlkP; |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index acc6fab601cc..3fa625db9e4b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -4332,7 +4332,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4332 | { | 4332 | { |
4333 | struct mgsl_struct *info; | 4333 | struct mgsl_struct *info; |
4334 | 4334 | ||
4335 | info = (struct mgsl_struct *)kmalloc(sizeof(struct mgsl_struct), | 4335 | info = kmalloc(sizeof(struct mgsl_struct), |
4336 | GFP_KERNEL); | 4336 | GFP_KERNEL); |
4337 | 4337 | ||
4338 | if (!info) { | 4338 | if (!info) { |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 53e8ccf94fe3..8f4d67afe5bf 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -2730,7 +2730,7 @@ static int startup(SLMP_INFO * info) | |||
2730 | return 0; | 2730 | return 0; |
2731 | 2731 | ||
2732 | if (!info->tx_buf) { | 2732 | if (!info->tx_buf) { |
2733 | info->tx_buf = (unsigned char *)kmalloc(info->max_frame_size, GFP_KERNEL); | 2733 | info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); |
2734 | if (!info->tx_buf) { | 2734 | if (!info->tx_buf) { |
2735 | printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", | 2735 | printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", |
2736 | __FILE__,__LINE__,info->device_name); | 2736 | __FILE__,__LINE__,info->device_name); |
@@ -3798,7 +3798,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3798 | { | 3798 | { |
3799 | SLMP_INFO *info; | 3799 | SLMP_INFO *info; |
3800 | 3800 | ||
3801 | info = (SLMP_INFO *)kmalloc(sizeof(SLMP_INFO), | 3801 | info = kmalloc(sizeof(SLMP_INFO), |
3802 | GFP_KERNEL); | 3802 | GFP_KERNEL); |
3803 | 3803 | ||
3804 | if (!info) { | 3804 | if (!info) { |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index a8239dac994f..06c32a3e3ca4 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -784,7 +784,7 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) | |||
784 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) | 784 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) |
785 | return 0; | 785 | return 0; |
786 | 786 | ||
787 | newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); | 787 | newscreen = kmalloc(new_screen_size, GFP_USER); |
788 | if (!newscreen) | 788 | if (!newscreen) |
789 | return -ENOMEM; | 789 | return -ENOMEM; |
790 | 790 | ||
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 311493e7b409..dc8368ebb1ac 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -129,7 +129,7 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str | |||
129 | !capable(CAP_SYS_RESOURCE)) | 129 | !capable(CAP_SYS_RESOURCE)) |
130 | return -EPERM; | 130 | return -EPERM; |
131 | 131 | ||
132 | key_map = (ushort *) kmalloc(sizeof(plain_map), | 132 | key_map = kmalloc(sizeof(plain_map), |
133 | GFP_KERNEL); | 133 | GFP_KERNEL); |
134 | if (!key_map) | 134 | if (!key_map) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
@@ -259,7 +259,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) | |||
259 | sz = 256; | 259 | sz = 256; |
260 | while (sz < funcbufsize - funcbufleft + delta) | 260 | while (sz < funcbufsize - funcbufleft + delta) |
261 | sz <<= 1; | 261 | sz <<= 1; |
262 | fnw = (char *) kmalloc(sz, GFP_KERNEL); | 262 | fnw = kmalloc(sz, GFP_KERNEL); |
263 | if(!fnw) { | 263 | if(!fnw) { |
264 | ret = -ENOMEM; | 264 | ret = -ENOMEM; |
265 | goto reterr; | 265 | goto reterr; |