From 5cbded585d129d0226cb48ac4202b253c781be26 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Wed, 13 Dec 2006 00:35:56 -0800 Subject: [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 , Ian Molton Cc: Mikael Starvik Cc: Yoshinori Sato Cc: Roman Zippel Cc: Geert Uytterhoeven Cc: Ralf Baechle Cc: Paul Mackerras Cc: Kyle McMartin Cc: Benjamin Herrenschmidt Cc: Martin Schwidefsky Cc: "David S. Miller" Cc: Jeff Dike Cc: Greg KH Cc: Jens Axboe Cc: Paul Fulghum Cc: Alan Cox Cc: Karsten Keil Cc: Mauro Carvalho Chehab Cc: Jeff Garzik Cc: James Bottomley Cc: Ian Kent Cc: Steven French Cc: David Woodhouse Cc: Neil Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/jffs/inode-v23.c | 4 ++-- fs/jffs/intrep.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'fs/jffs') diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 7b40c69f44eb..43baa1afa021 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c @@ -818,7 +818,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) D1({ int len = dentry->d_name.len; - char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); + char *_name = kmalloc(len + 1, GFP_KERNEL); memcpy(_name, dentry->d_name.name, len); _name[len] = '\0'; printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", " @@ -964,7 +964,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type) D1({ int len = dentry->d_name.len; const char *name = dentry->d_name.name; - char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); + char *_name = kmalloc(len + 1, GFP_KERNEL); memcpy(_name, name, len); _name[len] = '\0'; printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino); diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index d0e783f199ea..6dd18911b44c 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c @@ -436,7 +436,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result) int i, length; /* Allocate read buffer */ - read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); + read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); if (!read_buf) { printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n"); return -ENOMEM; @@ -744,11 +744,11 @@ static int check_partly_erased_sectors(struct jffs_fmcontrol *fmc){ /* Allocate read buffers */ - read_buf1 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); + read_buf1 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); if (!read_buf1) return -ENOMEM; - read_buf2 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); + read_buf2 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); if (!read_buf2) { kfree(read_buf1); return -ENOMEM; @@ -876,7 +876,7 @@ jffs_scan_flash(struct jffs_control *c) } /* Allocate read buffer */ - read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); + read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); if (!read_buf) { flash_safe_release(fmc->mtd); return -ENOMEM; @@ -1463,7 +1463,7 @@ jffs_insert_node(struct jffs_control *c, struct jffs_file *f, kfree(f->name); DJM(no_name--); } - if (!(f->name = (char *) kmalloc(raw_inode->nsize + 1, + if (!(f->name = kmalloc(raw_inode->nsize + 1, GFP_KERNEL))) { return -ENOMEM; } @@ -1737,7 +1737,7 @@ jffs_find_child(struct jffs_file *dir, const char *name, int len) printk("jffs_find_child(): Found \"%s\".\n", f->name); } else { - char *copy = (char *) kmalloc(len + 1, GFP_KERNEL); + char *copy = kmalloc(len + 1, GFP_KERNEL); if (copy) { memcpy(copy, name, len); copy[len] = '\0'; @@ -2627,7 +2627,7 @@ jffs_print_tree(struct jffs_file *first_file, int indent) return; } - if (!(space = (char *) kmalloc(indent + 1, GFP_KERNEL))) { + if (!(space = kmalloc(indent + 1, GFP_KERNEL))) { printk("jffs_print_tree(): Out of memory!\n"); return; } -- cgit v1.2.3