You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
committed by
Linus Torvalds
parent
0743b86800
commit
5cbded585d
@@ -423,7 +423,7 @@ static int apm_open(struct inode * inode, struct file * filp)
|
|||||||
{
|
{
|
||||||
struct apm_user *as;
|
struct apm_user *as;
|
||||||
|
|
||||||
as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL);
|
as = kzalloc(sizeof(*as), GFP_KERNEL);
|
||||||
if (as) {
|
if (as) {
|
||||||
/*
|
/*
|
||||||
* XXX - this is a tiny bit broken, when we consider BSD
|
* XXX - this is a tiny bit broken, when we consider BSD
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
|
|||||||
}
|
}
|
||||||
if (c_id(&excd) == 0x80) { /* loader */
|
if (c_id(&excd) == 0x80) { /* loader */
|
||||||
if (!ec->loader) {
|
if (!ec->loader) {
|
||||||
ec->loader = (loader_t)kmalloc(c_len(&excd),
|
ec->loader = kmalloc(c_len(&excd),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (ec->loader)
|
if (ec->loader)
|
||||||
ecard_readbytes(ec->loader, ec,
|
ecard_readbytes(ec->loader, ec,
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
|
|||||||
}
|
}
|
||||||
if (c_id(&excd) == 0x80) { /* loader */
|
if (c_id(&excd) == 0x80) { /* loader */
|
||||||
if (!ec->loader) {
|
if (!ec->loader) {
|
||||||
ec->loader = (loader_t)kmalloc(c_len(&excd),
|
ec->loader = kmalloc(c_len(&excd),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (ec->loader)
|
if (ec->loader)
|
||||||
ecard_readbytes(ec->loader, ec,
|
ecard_readbytes(ec->loader, ec,
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_
|
|||||||
(irq_flags & IRQF_SHARED && !dev_id))
|
(irq_flags & IRQF_SHARED && !dev_id))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
|
action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
|
||||||
if (!action)
|
if (!action)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ static int __init init_axis_flash(void)
|
|||||||
#else
|
#else
|
||||||
struct mtd_info *mtd_ram;
|
struct mtd_info *mtd_ram;
|
||||||
|
|
||||||
mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info),
|
mtd_ram = kmalloc(sizeof(struct mtd_info),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!mtd_ram) {
|
if (!mtd_ram) {
|
||||||
panic("axisflashmap couldn't allocate memory for "
|
panic("axisflashmap couldn't allocate memory for "
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ gpio_open(struct inode *inode, struct file *filp)
|
|||||||
if (p > GPIO_MINOR_LAST)
|
if (p > GPIO_MINOR_LAST)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private),
|
priv = kmalloc(sizeof(struct gpio_private),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!priv)
|
if (!priv)
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ static int __init init_axis_flash(void)
|
|||||||
#else
|
#else
|
||||||
struct mtd_info *mtd_ram;
|
struct mtd_info *mtd_ram;
|
||||||
|
|
||||||
mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info),
|
mtd_ram = kmalloc(sizeof(struct mtd_info),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!mtd_ram) {
|
if (!mtd_ram) {
|
||||||
panic("axisflashmap couldn't allocate memory for "
|
panic("axisflashmap couldn't allocate memory for "
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ gpio_open(struct inode *inode, struct file *filp)
|
|||||||
if (p > GPIO_MINOR_LAST)
|
if (p > GPIO_MINOR_LAST)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private),
|
priv = kmalloc(sizeof(struct gpio_private),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!priv)
|
if (!priv)
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
|
|||||||
int __init
|
int __init
|
||||||
cris_init_signal(void)
|
cris_init_signal(void)
|
||||||
{
|
{
|
||||||
u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL);
|
u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||||
|
|
||||||
/* This is movu.w __NR_sigreturn, r9; break 13; */
|
/* This is movu.w __NR_sigreturn, r9; break 13; */
|
||||||
data[0] = 0x9c5f;
|
data[0] = 0x9c5f;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ static int
|
|||||||
__init init_cris_profile(void)
|
__init init_cris_profile(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry;
|
struct proc_dir_entry *entry;
|
||||||
sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
|
sample_buffer = kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
|
||||||
sample_buffer_pos = sample_buffer;
|
sample_buffer_pos = sample_buffer;
|
||||||
entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL);
|
entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ int request_irq(unsigned int irq,
|
|||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
if (use_kmalloc)
|
if (use_kmalloc)
|
||||||
irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
|
irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
|
||||||
else {
|
else {
|
||||||
/* use bootmem allocater */
|
/* use bootmem allocater */
|
||||||
irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
|
irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ int request_irq(unsigned int irq,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (use_kmalloc)
|
if (use_kmalloc)
|
||||||
irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
|
irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
|
||||||
else {
|
else {
|
||||||
/* use bootmem allocater */
|
/* use bootmem allocater */
|
||||||
irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
|
irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
|
||||||
|
|||||||
@@ -1604,7 +1604,7 @@ static int do_open(struct inode * inode, struct file * filp)
|
|||||||
{
|
{
|
||||||
struct apm_user * as;
|
struct apm_user * as;
|
||||||
|
|
||||||
as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL);
|
as = kmalloc(sizeof(*as), GFP_KERNEL);
|
||||||
if (as == NULL) {
|
if (as == NULL) {
|
||||||
printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
|
printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
|
||||||
sizeof(*as));
|
sizeof(*as));
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ static void print_pci_topology(struct seq_file *s)
|
|||||||
int e;
|
int e;
|
||||||
|
|
||||||
for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) {
|
for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) {
|
||||||
if (!(p = (char *)kmalloc(sz, GFP_KERNEL)))
|
if (!(p = kmalloc(sz, GFP_KERNEL)))
|
||||||
break;
|
break;
|
||||||
e = ia64_sn_ioif_get_pci_topology(__pa(p), sz);
|
e = ia64_sn_ioif_get_pci_topology(__pa(p), sz);
|
||||||
if (e == SALRET_OK)
|
if (e == SALRET_OK)
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ static struct vm_struct *get_io_area(unsigned long size)
|
|||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
struct vm_struct **p, *tmp, *area;
|
struct vm_struct **p, *tmp, *area;
|
||||||
|
|
||||||
area = (struct vm_struct *)kmalloc(sizeof(*area), GFP_KERNEL);
|
area = kmalloc(sizeof(*area), GFP_KERNEL);
|
||||||
if (!area)
|
if (!area)
|
||||||
return NULL;
|
return NULL;
|
||||||
addr = KMAP_START;
|
addr = KMAP_START;
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ static int apm_open(struct inode * inode, struct file * filp)
|
|||||||
{
|
{
|
||||||
struct apm_user *as;
|
struct apm_user *as;
|
||||||
|
|
||||||
as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL);
|
as = kzalloc(sizeof(*as), GFP_KERNEL);
|
||||||
if (as) {
|
if (as) {
|
||||||
/*
|
/*
|
||||||
* XXX - this is a tiny bit broken, when we consider BSD
|
* XXX - this is a tiny bit broken, when we consider BSD
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
|
|||||||
printk(KERN_DEBUG "len of arg1 = %d\n", len);
|
printk(KERN_DEBUG "len of arg1 = %d\n", len);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
fsname = (char *) kmalloc(len, GFP_KERNEL);
|
fsname = kmalloc(len, GFP_KERNEL);
|
||||||
if ( !fsname ) {
|
if ( !fsname ) {
|
||||||
printk(KERN_DEBUG "failed to kmalloc fsname\n");
|
printk(KERN_DEBUG "failed to kmalloc fsname\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct
|
|||||||
struct pt_regs *r = &t->thread.regs;
|
struct pt_regs *r = &t->thread.regs;
|
||||||
struct pt_regs *r2;
|
struct pt_regs *r2;
|
||||||
|
|
||||||
r2 = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL);
|
r2 = kmalloc(sizeof(struct pt_regs), GFP_KERNEL);
|
||||||
if (!r2)
|
if (!r2)
|
||||||
return;
|
return;
|
||||||
*r2 = *r;
|
*r2 = *r;
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ static int nvram_scan_partitions(void)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
total_size = ppc_md.nvram_size();
|
total_size = ppc_md.nvram_size();
|
||||||
|
|
||||||
header = (char *) kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL);
|
header = kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL);
|
||||||
if (!header) {
|
if (!header) {
|
||||||
printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n");
|
printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -574,7 +574,7 @@ static int __init nvram_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* initialize our anchor for the nvram partition list */
|
/* initialize our anchor for the nvram partition list */
|
||||||
nvram_part = (struct nvram_partition *) kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
|
nvram_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
|
||||||
if (!nvram_part) {
|
if (!nvram_part) {
|
||||||
printk(KERN_ERR "nvram_init: Failed kmalloc\n");
|
printk(KERN_ERR "nvram_init: Failed kmalloc\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|||||||
@@ -670,7 +670,7 @@ pcibios_make_OF_bus_map(void)
|
|||||||
struct pci_controller* hose;
|
struct pci_controller* hose;
|
||||||
struct property *map_prop;
|
struct property *map_prop;
|
||||||
|
|
||||||
pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
|
pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
|
||||||
if (!pci_to_OF_bus_map) {
|
if (!pci_to_OF_bus_map) {
|
||||||
printk(KERN_ERR "Can't allocate OF bus map !\n");
|
printk(KERN_ERR "Can't allocate OF bus map !\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user