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 /arch | |
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 'arch')
30 files changed, 40 insertions, 40 deletions
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c index a11fb9a40c04..2c37b70b17ab 100644 --- a/arch/arm/kernel/apm.c +++ b/arch/arm/kernel/apm.c | |||
@@ -423,7 +423,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
423 | { | 423 | { |
424 | struct apm_user *as; | 424 | struct apm_user *as; |
425 | 425 | ||
426 | as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); | 426 | as = kzalloc(sizeof(*as), GFP_KERNEL); |
427 | if (as) { | 427 | if (as) { |
428 | /* | 428 | /* |
429 | * XXX - this is a tiny bit broken, when we consider BSD | 429 | * XXX - this is a tiny bit broken, when we consider BSD |
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index a786f769035d..71257e3d513f 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
@@ -353,7 +353,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num) | |||
353 | } | 353 | } |
354 | if (c_id(&excd) == 0x80) { /* loader */ | 354 | if (c_id(&excd) == 0x80) { /* loader */ |
355 | if (!ec->loader) { | 355 | if (!ec->loader) { |
356 | ec->loader = (loader_t)kmalloc(c_len(&excd), | 356 | ec->loader = kmalloc(c_len(&excd), |
357 | GFP_KERNEL); | 357 | GFP_KERNEL); |
358 | if (ec->loader) | 358 | if (ec->loader) |
359 | ecard_readbytes(ec->loader, ec, | 359 | ecard_readbytes(ec->loader, ec, |
diff --git a/arch/arm26/kernel/ecard.c b/arch/arm26/kernel/ecard.c index 43dd41be71fb..9dbc17247c6f 100644 --- a/arch/arm26/kernel/ecard.c +++ b/arch/arm26/kernel/ecard.c | |||
@@ -215,7 +215,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num) | |||
215 | } | 215 | } |
216 | if (c_id(&excd) == 0x80) { /* loader */ | 216 | if (c_id(&excd) == 0x80) { /* loader */ |
217 | if (!ec->loader) { | 217 | if (!ec->loader) { |
218 | ec->loader = (loader_t)kmalloc(c_len(&excd), | 218 | ec->loader = kmalloc(c_len(&excd), |
219 | GFP_KERNEL); | 219 | GFP_KERNEL); |
220 | if (ec->loader) | 220 | if (ec->loader) |
221 | ecard_readbytes(ec->loader, ec, | 221 | ecard_readbytes(ec->loader, ec, |
diff --git a/arch/arm26/kernel/irq.c b/arch/arm26/kernel/irq.c index d87d68b77d66..d53382c83bf9 100644 --- a/arch/arm26/kernel/irq.c +++ b/arch/arm26/kernel/irq.c | |||
@@ -545,7 +545,7 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_ | |||
545 | (irq_flags & IRQF_SHARED && !dev_id)) | 545 | (irq_flags & IRQF_SHARED && !dev_id)) |
546 | return -EINVAL; | 546 | return -EINVAL; |
547 | 547 | ||
548 | action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); | 548 | action = kmalloc(sizeof(struct irqaction), GFP_KERNEL); |
549 | if (!action) | 549 | if (!action) |
550 | return -ENOMEM; | 550 | return -ENOMEM; |
551 | 551 | ||
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c index 4fa81abab0c7..ffade19a14e6 100644 --- a/arch/cris/arch-v10/drivers/axisflashmap.c +++ b/arch/cris/arch-v10/drivers/axisflashmap.c | |||
@@ -516,7 +516,7 @@ static int __init init_axis_flash(void) | |||
516 | #else | 516 | #else |
517 | struct mtd_info *mtd_ram; | 517 | struct mtd_info *mtd_ram; |
518 | 518 | ||
519 | mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), | 519 | mtd_ram = kmalloc(sizeof(struct mtd_info), |
520 | GFP_KERNEL); | 520 | GFP_KERNEL); |
521 | if (!mtd_ram) { | 521 | if (!mtd_ram) { |
522 | panic("axisflashmap couldn't allocate memory for " | 522 | panic("axisflashmap couldn't allocate memory for " |
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c index fcba6632ed7b..9aba18b931dd 100644 --- a/arch/cris/arch-v10/drivers/gpio.c +++ b/arch/cris/arch-v10/drivers/gpio.c | |||
@@ -440,7 +440,7 @@ gpio_open(struct inode *inode, struct file *filp) | |||
440 | if (p > GPIO_MINOR_LAST) | 440 | if (p > GPIO_MINOR_LAST) |
441 | return -EINVAL; | 441 | return -EINVAL; |
442 | 442 | ||
443 | priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), | 443 | priv = kmalloc(sizeof(struct gpio_private), |
444 | GFP_KERNEL); | 444 | GFP_KERNEL); |
445 | 445 | ||
446 | if (!priv) | 446 | if (!priv) |
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c index 41952320e00a..5180d45412fc 100644 --- a/arch/cris/arch-v32/drivers/axisflashmap.c +++ b/arch/cris/arch-v32/drivers/axisflashmap.c | |||
@@ -427,7 +427,7 @@ static int __init init_axis_flash(void) | |||
427 | #else | 427 | #else |
428 | struct mtd_info *mtd_ram; | 428 | struct mtd_info *mtd_ram; |
429 | 429 | ||
430 | mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), | 430 | mtd_ram = kmalloc(sizeof(struct mtd_info), |
431 | GFP_KERNEL); | 431 | GFP_KERNEL); |
432 | if (!mtd_ram) { | 432 | if (!mtd_ram) { |
433 | panic("axisflashmap couldn't allocate memory for " | 433 | panic("axisflashmap couldn't allocate memory for " |
diff --git a/arch/cris/arch-v32/drivers/gpio.c b/arch/cris/arch-v32/drivers/gpio.c index c3f876b4da6b..08d36f0955c6 100644 --- a/arch/cris/arch-v32/drivers/gpio.c +++ b/arch/cris/arch-v32/drivers/gpio.c | |||
@@ -423,7 +423,7 @@ gpio_open(struct inode *inode, struct file *filp) | |||
423 | if (p > GPIO_MINOR_LAST) | 423 | if (p > GPIO_MINOR_LAST) |
424 | return -EINVAL; | 424 | return -EINVAL; |
425 | 425 | ||
426 | priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), | 426 | priv = kmalloc(sizeof(struct gpio_private), |
427 | GFP_KERNEL); | 427 | GFP_KERNEL); |
428 | 428 | ||
429 | if (!priv) | 429 | if (!priv) |
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c index 99e59b3eacf8..7cd6ac803409 100644 --- a/arch/cris/arch-v32/kernel/signal.c +++ b/arch/cris/arch-v32/kernel/signal.c | |||
@@ -686,7 +686,7 @@ keep_debug_flags(unsigned long oldccs, unsigned long oldspc, | |||
686 | int __init | 686 | int __init |
687 | cris_init_signal(void) | 687 | cris_init_signal(void) |
688 | { | 688 | { |
689 | u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL); | 689 | u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL); |
690 | 690 | ||
691 | /* This is movu.w __NR_sigreturn, r9; break 13; */ | 691 | /* This is movu.w __NR_sigreturn, r9; break 13; */ |
692 | data[0] = 0x9c5f; | 692 | data[0] = 0x9c5f; |
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c index 69c52189f044..f60ab785f235 100644 --- a/arch/cris/kernel/profile.c +++ b/arch/cris/kernel/profile.c | |||
@@ -59,7 +59,7 @@ static int | |||
59 | __init init_cris_profile(void) | 59 | __init init_cris_profile(void) |
60 | { | 60 | { |
61 | struct proc_dir_entry *entry; | 61 | struct proc_dir_entry *entry; |
62 | sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL); | 62 | sample_buffer = kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL); |
63 | sample_buffer_pos = sample_buffer; | 63 | sample_buffer_pos = sample_buffer; |
64 | entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); | 64 | entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); |
65 | if (entry) { | 65 | if (entry) { |
diff --git a/arch/h8300/kernel/ints.c b/arch/h8300/kernel/ints.c index 1bfc77e391d5..587ef7f4fcc7 100644 --- a/arch/h8300/kernel/ints.c +++ b/arch/h8300/kernel/ints.c | |||
@@ -141,7 +141,7 @@ int request_irq(unsigned int irq, | |||
141 | return -EBUSY; | 141 | return -EBUSY; |
142 | 142 | ||
143 | if (use_kmalloc) | 143 | if (use_kmalloc) |
144 | irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); | 144 | irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); |
145 | else { | 145 | else { |
146 | /* use bootmem allocater */ | 146 | /* use bootmem allocater */ |
147 | irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); | 147 | irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); |
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c index 270440de4610..567f681ddfec 100644 --- a/arch/h8300/platform/h8s/ints.c +++ b/arch/h8300/platform/h8s/ints.c | |||
@@ -176,7 +176,7 @@ int request_irq(unsigned int irq, | |||
176 | } | 176 | } |
177 | 177 | ||
178 | if (use_kmalloc) | 178 | if (use_kmalloc) |
179 | irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); | 179 | irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); |
180 | else { | 180 | else { |
181 | /* use bootmem allocater */ | 181 | /* use bootmem allocater */ |
182 | irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); | 182 | irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); |
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index a97847da9ed5..b75cff25de4b 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -1604,7 +1604,7 @@ static int do_open(struct inode * inode, struct file * filp) | |||
1604 | { | 1604 | { |
1605 | struct apm_user * as; | 1605 | struct apm_user * as; |
1606 | 1606 | ||
1607 | as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); | 1607 | as = kmalloc(sizeof(*as), GFP_KERNEL); |
1608 | if (as == NULL) { | 1608 | if (as == NULL) { |
1609 | printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", | 1609 | printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", |
1610 | sizeof(*as)); | 1610 | sizeof(*as)); |
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c index 462ea178f49a..33367996d72d 100644 --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c | |||
@@ -189,7 +189,7 @@ static void print_pci_topology(struct seq_file *s) | |||
189 | int e; | 189 | int e; |
190 | 190 | ||
191 | for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { | 191 | for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { |
192 | if (!(p = (char *)kmalloc(sz, GFP_KERNEL))) | 192 | if (!(p = kmalloc(sz, GFP_KERNEL))) |
193 | break; | 193 | break; |
194 | e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); | 194 | e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); |
195 | if (e == SALRET_OK) | 195 | if (e == SALRET_OK) |
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c index b54ef1726c55..46b7d6035aab 100644 --- a/arch/m68k/mm/kmap.c +++ b/arch/m68k/mm/kmap.c | |||
@@ -59,7 +59,7 @@ static struct vm_struct *get_io_area(unsigned long size) | |||
59 | unsigned long addr; | 59 | unsigned long addr; |
60 | struct vm_struct **p, *tmp, *area; | 60 | struct vm_struct **p, *tmp, *area; |
61 | 61 | ||
62 | area = (struct vm_struct *)kmalloc(sizeof(*area), GFP_KERNEL); | 62 | area = kmalloc(sizeof(*area), GFP_KERNEL); |
63 | if (!area) | 63 | if (!area) |
64 | return NULL; | 64 | return NULL; |
65 | addr = KMAP_START; | 65 | addr = KMAP_START; |
diff --git a/arch/mips/kernel/apm.c b/arch/mips/kernel/apm.c index 528e731049c1..ba16d07588cb 100644 --- a/arch/mips/kernel/apm.c +++ b/arch/mips/kernel/apm.c | |||
@@ -356,7 +356,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
356 | { | 356 | { |
357 | struct apm_user *as; | 357 | struct apm_user *as; |
358 | 358 | ||
359 | as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); | 359 | as = kzalloc(sizeof(*as), GFP_KERNEL); |
360 | if (as) { | 360 | if (as) { |
361 | /* | 361 | /* |
362 | * XXX - this is a tiny bit broken, when we consider BSD | 362 | * XXX - this is a tiny bit broken, when we consider BSD |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index d88309209f56..04c2ff444396 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -475,7 +475,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) | |||
475 | printk(KERN_DEBUG "len of arg1 = %d\n", len); | 475 | printk(KERN_DEBUG "len of arg1 = %d\n", len); |
476 | if (len == 0) | 476 | if (len == 0) |
477 | return 0; | 477 | return 0; |
478 | fsname = (char *) kmalloc(len, GFP_KERNEL); | 478 | fsname = kmalloc(len, GFP_KERNEL); |
479 | if ( !fsname ) { | 479 | if ( !fsname ) { |
480 | printk(KERN_DEBUG "failed to kmalloc fsname\n"); | 480 | printk(KERN_DEBUG "failed to kmalloc fsname\n"); |
481 | return 0; | 481 | return 0; |
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index 920bdbf8404f..c10ab47d81fa 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c | |||
@@ -343,7 +343,7 @@ void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct | |||
343 | struct pt_regs *r = &t->thread.regs; | 343 | struct pt_regs *r = &t->thread.regs; |
344 | struct pt_regs *r2; | 344 | struct pt_regs *r2; |
345 | 345 | ||
346 | r2 = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL); | 346 | r2 = kmalloc(sizeof(struct pt_regs), GFP_KERNEL); |
347 | if (!r2) | 347 | if (!r2) |
348 | return; | 348 | return; |
349 | *r2 = *r; | 349 | *r2 = *r; |
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c index 6960f090991e..869cebbba967 100644 --- a/arch/powerpc/kernel/nvram_64.c +++ b/arch/powerpc/kernel/nvram_64.c | |||
@@ -505,7 +505,7 @@ static int nvram_scan_partitions(void) | |||
505 | return -ENODEV; | 505 | return -ENODEV; |
506 | total_size = ppc_md.nvram_size(); | 506 | total_size = ppc_md.nvram_size(); |
507 | 507 | ||
508 | header = (char *) kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL); | 508 | header = kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL); |
509 | if (!header) { | 509 | if (!header) { |
510 | printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n"); | 510 | printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n"); |
511 | return -ENOMEM; | 511 | return -ENOMEM; |
@@ -574,7 +574,7 @@ static int __init nvram_init(void) | |||
574 | } | 574 | } |
575 | 575 | ||
576 | /* initialize our anchor for the nvram partition list */ | 576 | /* initialize our anchor for the nvram partition list */ |
577 | nvram_part = (struct nvram_partition *) kmalloc(sizeof(struct nvram_partition), GFP_KERNEL); | 577 | nvram_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL); |
578 | if (!nvram_part) { | 578 | if (!nvram_part) { |
579 | printk(KERN_ERR "nvram_init: Failed kmalloc\n"); | 579 | printk(KERN_ERR "nvram_init: Failed kmalloc\n"); |
580 | return -ENOMEM; | 580 | return -ENOMEM; |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 8336deafc624..2847cd51a2d7 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -670,7 +670,7 @@ pcibios_make_OF_bus_map(void) | |||
670 | struct pci_controller* hose; | 670 | struct pci_controller* hose; |
671 | struct property *map_prop; | 671 | struct property *map_prop; |
672 | 672 | ||
673 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); | 673 | pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL); |
674 | if (!pci_to_OF_bus_map) { | 674 | if (!pci_to_OF_bus_map) { |
675 | printk(KERN_ERR "Can't allocate OF bus map !\n"); | 675 | printk(KERN_ERR "Can't allocate OF bus map !\n"); |
676 | return; | 676 | return; |
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c index add8c1a9af68..c831815c31f0 100644 --- a/arch/powerpc/mm/imalloc.c +++ b/arch/powerpc/mm/imalloc.c | |||
@@ -138,7 +138,7 @@ static struct vm_struct * split_im_region(unsigned long v_addr, | |||
138 | struct vm_struct *vm2 = NULL; | 138 | struct vm_struct *vm2 = NULL; |
139 | struct vm_struct *new_vm = NULL; | 139 | struct vm_struct *new_vm = NULL; |
140 | 140 | ||
141 | vm1 = (struct vm_struct *) kmalloc(sizeof(*vm1), GFP_KERNEL); | 141 | vm1 = kmalloc(sizeof(*vm1), GFP_KERNEL); |
142 | if (vm1 == NULL) { | 142 | if (vm1 == NULL) { |
143 | printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); | 143 | printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); |
144 | return NULL; | 144 | return NULL; |
@@ -172,7 +172,7 @@ static struct vm_struct * split_im_region(unsigned long v_addr, | |||
172 | * uppermost remainder, and use existing parent one for the | 172 | * uppermost remainder, and use existing parent one for the |
173 | * lower remainder of parent range | 173 | * lower remainder of parent range |
174 | */ | 174 | */ |
175 | vm2 = (struct vm_struct *) kmalloc(sizeof(*vm2), GFP_KERNEL); | 175 | vm2 = kmalloc(sizeof(*vm2), GFP_KERNEL); |
176 | if (vm2 == NULL) { | 176 | if (vm2 == NULL) { |
177 | printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); | 177 | printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); |
178 | kfree(vm1); | 178 | kfree(vm1); |
@@ -206,7 +206,7 @@ static struct vm_struct * __add_new_im_area(unsigned long req_addr, | |||
206 | break; | 206 | break; |
207 | } | 207 | } |
208 | 208 | ||
209 | area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL); | 209 | area = kmalloc(sizeof(*area), GFP_KERNEL); |
210 | if (!area) | 210 | if (!area) |
211 | return NULL; | 211 | return NULL; |
212 | area->flags = 0; | 212 | area->flags = 0; |
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c index b6b462d3c604..f2bae04424f8 100644 --- a/arch/powerpc/platforms/pseries/eeh_cache.c +++ b/arch/powerpc/platforms/pseries/eeh_cache.c | |||
@@ -153,7 +153,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
153 | return piar; | 153 | return piar; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); | 156 | piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); |
157 | if (!piar) | 157 | if (!piar) |
158 | return NULL; | 158 | return NULL; |
159 | 159 | ||
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c index 709952c25f29..06b84c372e58 100644 --- a/arch/ppc/8260_io/fcc_enet.c +++ b/arch/ppc/8260_io/fcc_enet.c | |||
@@ -1892,10 +1892,10 @@ init_fcc_param(fcc_info_t *fip, struct net_device *dev, | |||
1892 | /* Allocate space for the buffer descriptors from regular memory. | 1892 | /* Allocate space for the buffer descriptors from regular memory. |
1893 | * Initialize base addresses for the buffer descriptors. | 1893 | * Initialize base addresses for the buffer descriptors. |
1894 | */ | 1894 | */ |
1895 | cep->rx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * RX_RING_SIZE, | 1895 | cep->rx_bd_base = kmalloc(sizeof(cbd_t) * RX_RING_SIZE, |
1896 | GFP_KERNEL | GFP_DMA); | 1896 | GFP_KERNEL | GFP_DMA); |
1897 | ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); | 1897 | ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); |
1898 | cep->tx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * TX_RING_SIZE, | 1898 | cep->tx_bd_base = kmalloc(sizeof(cbd_t) * TX_RING_SIZE, |
1899 | GFP_KERNEL | GFP_DMA); | 1899 | GFP_KERNEL | GFP_DMA); |
1900 | ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); | 1900 | ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); |
1901 | 1901 | ||
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c index c71ef3c2e7bf..b7bb5f0b3c5f 100644 --- a/arch/ppc/8xx_io/cs4218_tdm.c +++ b/arch/ppc/8xx_io/cs4218_tdm.c | |||
@@ -2601,7 +2601,7 @@ int __init tdm8xx_sound_init(void) | |||
2601 | /* Initialize beep stuff */ | 2601 | /* Initialize beep stuff */ |
2602 | orig_mksound = kd_mksound; | 2602 | orig_mksound = kd_mksound; |
2603 | kd_mksound = cs_mksound; | 2603 | kd_mksound = cs_mksound; |
2604 | beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); | 2604 | beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); |
2605 | if (beep_buf == NULL) | 2605 | if (beep_buf == NULL) |
2606 | printk(KERN_WARNING "dmasound: no memory for " | 2606 | printk(KERN_WARNING "dmasound: no memory for " |
2607 | "beep buffer\n"); | 2607 | "beep buffer\n"); |
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index ef5266fbce62..bb57bc0e3fc8 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c | |||
@@ -191,13 +191,13 @@ debug_areas_alloc(int pages_per_area, int nr_areas) | |||
191 | debug_entry_t*** areas; | 191 | debug_entry_t*** areas; |
192 | int i,j; | 192 | int i,j; |
193 | 193 | ||
194 | areas = (debug_entry_t ***) kmalloc(nr_areas * | 194 | areas = kmalloc(nr_areas * |
195 | sizeof(debug_entry_t**), | 195 | sizeof(debug_entry_t**), |
196 | GFP_KERNEL); | 196 | GFP_KERNEL); |
197 | if (!areas) | 197 | if (!areas) |
198 | goto fail_malloc_areas; | 198 | goto fail_malloc_areas; |
199 | for (i = 0; i < nr_areas; i++) { | 199 | for (i = 0; i < nr_areas; i++) { |
200 | areas[i] = (debug_entry_t**) kmalloc(pages_per_area * | 200 | areas[i] = kmalloc(pages_per_area * |
201 | sizeof(debug_entry_t*),GFP_KERNEL); | 201 | sizeof(debug_entry_t*),GFP_KERNEL); |
202 | if (!areas[i]) { | 202 | if (!areas[i]) { |
203 | goto fail_malloc_areas2; | 203 | goto fail_malloc_areas2; |
@@ -242,7 +242,7 @@ debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size, | |||
242 | 242 | ||
243 | /* alloc everything */ | 243 | /* alloc everything */ |
244 | 244 | ||
245 | rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL); | 245 | rc = kmalloc(sizeof(debug_info_t), GFP_KERNEL); |
246 | if(!rc) | 246 | if(!rc) |
247 | goto fail_malloc_rc; | 247 | goto fail_malloc_rc; |
248 | rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL); | 248 | rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL); |
@@ -634,7 +634,7 @@ found: | |||
634 | rc = -ENOMEM; | 634 | rc = -ENOMEM; |
635 | goto out; | 635 | goto out; |
636 | } | 636 | } |
637 | p_info = (file_private_info_t *) kmalloc(sizeof(file_private_info_t), | 637 | p_info = kmalloc(sizeof(file_private_info_t), |
638 | GFP_KERNEL); | 638 | GFP_KERNEL); |
639 | if(!p_info){ | 639 | if(!p_info){ |
640 | if(debug_info_snapshot) | 640 | if(debug_info_snapshot) |
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c index 4faf96f8a834..bc5beaa8f98e 100644 --- a/arch/s390/kernel/s390_ext.c +++ b/arch/s390/kernel/s390_ext.c | |||
@@ -37,7 +37,7 @@ int register_external_interrupt(__u16 code, ext_int_handler_t handler) | |||
37 | ext_int_info_t *p; | 37 | ext_int_info_t *p; |
38 | int index; | 38 | int index; |
39 | 39 | ||
40 | p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); | 40 | p = kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); |
41 | if (p == NULL) | 41 | if (p == NULL) |
42 | return -ENOMEM; | 42 | return -ENOMEM; |
43 | p->code = code; | 43 | p->code = code; |
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c index c8cb211b9072..5b4841d067c1 100644 --- a/arch/sparc/kernel/irq.c +++ b/arch/sparc/kernel/irq.c | |||
@@ -425,7 +425,7 @@ int request_fast_irq(unsigned int irq, | |||
425 | } | 425 | } |
426 | 426 | ||
427 | if (action == NULL) | 427 | if (action == NULL) |
428 | action = (struct irqaction *)kmalloc(sizeof(struct irqaction), | 428 | action = kmalloc(sizeof(struct irqaction), |
429 | GFP_ATOMIC); | 429 | GFP_ATOMIC); |
430 | 430 | ||
431 | if (!action) { | 431 | if (!action) { |
@@ -528,7 +528,7 @@ int request_irq(unsigned int irq, | |||
528 | } | 528 | } |
529 | 529 | ||
530 | if (action == NULL) | 530 | if (action == NULL) |
531 | action = (struct irqaction *)kmalloc(sizeof(struct irqaction), | 531 | action = kmalloc(sizeof(struct irqaction), |
532 | GFP_ATOMIC); | 532 | GFP_ATOMIC); |
533 | 533 | ||
534 | if (!action) { | 534 | if (!action) { |
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index cf1b8baa57ea..0e27e226e0e2 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c | |||
@@ -327,7 +327,7 @@ int sun4d_request_irq(unsigned int irq, | |||
327 | } | 327 | } |
328 | 328 | ||
329 | if (action == NULL) | 329 | if (action == NULL) |
330 | action = (struct irqaction *)kmalloc(sizeof(struct irqaction), | 330 | action = kmalloc(sizeof(struct irqaction), |
331 | GFP_ATOMIC); | 331 | GFP_ATOMIC); |
332 | 332 | ||
333 | if (!action) { | 333 | if (!action) { |
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index 4446f66590fa..2ebc2c051383 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c | |||
@@ -1055,7 +1055,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) | |||
1055 | break; | 1055 | break; |
1056 | case 2: | 1056 | case 2: |
1057 | rval = -EFAULT; | 1057 | rval = -EFAULT; |
1058 | kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, | 1058 | kmbuf = kmalloc(sizeof(struct msgbuf) + arg3, |
1059 | GFP_KERNEL); | 1059 | GFP_KERNEL); |
1060 | if (!kmbuf) | 1060 | if (!kmbuf) |
1061 | break; | 1061 | break; |
@@ -1078,7 +1078,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) | |||
1078 | break; | 1078 | break; |
1079 | case 3: | 1079 | case 3: |
1080 | rval = -EFAULT; | 1080 | rval = -EFAULT; |
1081 | kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, | 1081 | kmbuf = kmalloc(sizeof(struct msgbuf) + arg3, |
1082 | GFP_KERNEL); | 1082 | GFP_KERNEL); |
1083 | if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, | 1083 | if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, |
1084 | kmbuf, arg3)) | 1084 | kmbuf, arg3)) |
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 49057d8bc668..5db7737df0ff 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c | |||
@@ -166,7 +166,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount) | |||
166 | struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) { | 166 | struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) { |
167 | .func = 0, | 167 | .func = 0, |
168 | .bytecount = bytecount, | 168 | .bytecount = bytecount, |
169 | .ptr = (void *)kmalloc(bytecount, GFP_KERNEL)}; | 169 | .ptr = kmalloc(bytecount, GFP_KERNEL)}; |
170 | u32 cpu; | 170 | u32 cpu; |
171 | 171 | ||
172 | if(ptrace_ldt.ptr == NULL) | 172 | if(ptrace_ldt.ptr == NULL) |
@@ -426,7 +426,7 @@ void ldt_get_host_info(void) | |||
426 | host_ldt_entries = dummy_list; | 426 | host_ldt_entries = dummy_list; |
427 | else { | 427 | else { |
428 | size = (size + 1) * sizeof(dummy_list[0]); | 428 | size = (size + 1) * sizeof(dummy_list[0]); |
429 | host_ldt_entries = (short *)kmalloc(size, GFP_KERNEL); | 429 | host_ldt_entries = kmalloc(size, GFP_KERNEL); |
430 | if(host_ldt_entries == NULL) { | 430 | if(host_ldt_entries == NULL) { |
431 | printk("ldt_get_host_info: couldn't allocate host ldt list\n"); | 431 | printk("ldt_get_host_info: couldn't allocate host ldt list\n"); |
432 | goto out_free; | 432 | goto out_free; |