diff options
| author | Panagiotis Issaris <takis@issaris.org> | 2006-09-27 04:49:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:10 -0400 |
| commit | f52720ca5f48574e347dff35ffe6b389ace61537 (patch) | |
| tree | 7efc8ec6bad32b98e406a5c553149d57e46bd07e | |
| parent | f8314dc60ccba7e41f425048c4160dc7f63377d5 (diff) | |
[PATCH] fs: Removing useless casts
* Removing useless casts
* Removing useless wrapper
* Conversion from kmalloc+memset to kzalloc
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Acked-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | fs/coda/dir.c | 2 | ||||
| -rw-r--r-- | fs/ext2/acl.c | 4 | ||||
| -rw-r--r-- | fs/ext3/acl.c | 4 | ||||
| -rw-r--r-- | fs/ext3/resize.c | 4 | ||||
| -rw-r--r-- | fs/hpfs/buffer.c | 2 | ||||
| -rw-r--r-- | fs/jffs/inode-v23.c | 8 | ||||
| -rw-r--r-- | fs/jffs/intrep.c | 11 | ||||
| -rw-r--r-- | fs/jffs/jffs_fm.c | 6 | ||||
| -rw-r--r-- | fs/jfs/jfs_txnmgr.c | 4 | ||||
| -rw-r--r-- | fs/lockd/clntproc.c | 2 | ||||
| -rw-r--r-- | fs/ncpfs/symlink.c | 4 | ||||
| -rw-r--r-- | fs/nfs/delegation.c | 7 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs3proc.c | 2 | ||||
| -rw-r--r-- | fs/nfs/proc.c | 2 | ||||
| -rw-r--r-- | fs/ntfs/dir.c | 5 | ||||
| -rw-r--r-- | fs/ntfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/ntfs/mft.c | 4 | ||||
| -rw-r--r-- | fs/ntfs/unistr.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 4 |
21 files changed, 37 insertions, 48 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 71f2ea632e53..8651ea6a23b7 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
| @@ -513,7 +513,7 @@ static int coda_venus_readdir(struct file *filp, filldir_t filldir, | |||
| 513 | ino_t ino; | 513 | ino_t ino; |
| 514 | int ret, i; | 514 | int ret, i; |
| 515 | 515 | ||
| 516 | vdir = (struct venus_dirent *)kmalloc(sizeof(*vdir), GFP_KERNEL); | 516 | vdir = kmalloc(sizeof(*vdir), GFP_KERNEL); |
| 517 | if (!vdir) return -ENOMEM; | 517 | if (!vdir) return -ENOMEM; |
| 518 | 518 | ||
| 519 | i = filp->f_pos; | 519 | i = filp->f_pos; |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index da52b4a5db64..7c420b800c34 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
| @@ -89,8 +89,8 @@ ext2_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
| 89 | size_t n; | 89 | size_t n; |
| 90 | 90 | ||
| 91 | *size = ext2_acl_size(acl->a_count); | 91 | *size = ext2_acl_size(acl->a_count); |
| 92 | ext_acl = (ext2_acl_header *)kmalloc(sizeof(ext2_acl_header) + | 92 | ext_acl = kmalloc(sizeof(ext2_acl_header) + acl->a_count * |
| 93 | acl->a_count * sizeof(ext2_acl_entry), GFP_KERNEL); | 93 | sizeof(ext2_acl_entry), GFP_KERNEL); |
| 94 | if (!ext_acl) | 94 | if (!ext_acl) |
| 95 | return ERR_PTR(-ENOMEM); | 95 | return ERR_PTR(-ENOMEM); |
| 96 | ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); | 96 | ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); |
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 92bf78221429..1e5038d9a01b 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
| @@ -90,8 +90,8 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
| 90 | size_t n; | 90 | size_t n; |
| 91 | 91 | ||
| 92 | *size = ext3_acl_size(acl->a_count); | 92 | *size = ext3_acl_size(acl->a_count); |
| 93 | ext_acl = (ext3_acl_header *)kmalloc(sizeof(ext3_acl_header) + | 93 | ext_acl = kmalloc(sizeof(ext3_acl_header) + acl->a_count * |
| 94 | acl->a_count * sizeof(ext3_acl_entry), GFP_KERNEL); | 94 | sizeof(ext3_acl_entry), GFP_KERNEL); |
| 95 | if (!ext_acl) | 95 | if (!ext_acl) |
| 96 | return ERR_PTR(-ENOMEM); | 96 | return ERR_PTR(-ENOMEM); |
| 97 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); | 97 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 9e318a5cfc87..b73cba12f79c 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
| @@ -439,8 +439,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
| 439 | if ((err = ext3_reserve_inode_write(handle, inode, &iloc))) | 439 | if ((err = ext3_reserve_inode_write(handle, inode, &iloc))) |
| 440 | goto exit_dindj; | 440 | goto exit_dindj; |
| 441 | 441 | ||
| 442 | n_group_desc = (struct buffer_head **)kmalloc((gdb_num + 1) * | 442 | n_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *), |
| 443 | sizeof(struct buffer_head *), GFP_KERNEL); | 443 | GFP_KERNEL); |
| 444 | if (!n_group_desc) { | 444 | if (!n_group_desc) { |
| 445 | err = -ENOMEM; | 445 | err = -ENOMEM; |
| 446 | ext3_warning (sb, __FUNCTION__, | 446 | ext3_warning (sb, __FUNCTION__, |
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index 2807aa833e62..b52b7381d10f 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c | |||
| @@ -76,7 +76,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
| 76 | return NULL; | 76 | return NULL; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | qbh->data = data = (char *)kmalloc(2048, GFP_NOFS); | 79 | qbh->data = data = kmalloc(2048, GFP_NOFS); |
| 80 | if (!data) { | 80 | if (!data) { |
| 81 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); | 81 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); |
| 82 | goto bail; | 82 | goto bail; |
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 93068697a9bf..b59553d28d13 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c | |||
| @@ -652,7 +652,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 652 | lock_kernel(); | 652 | lock_kernel(); |
| 653 | 653 | ||
| 654 | D3({ | 654 | D3({ |
| 655 | char *s = (char *)kmalloc(len + 1, GFP_KERNEL); | 655 | char *s = kmalloc(len + 1, GFP_KERNEL); |
| 656 | memcpy(s, name, len); | 656 | memcpy(s, name, len); |
| 657 | s[len] = '\0'; | 657 | s[len] = '\0'; |
| 658 | printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s); | 658 | printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s); |
| @@ -1173,8 +1173,8 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
| 1173 | lock_kernel(); | 1173 | lock_kernel(); |
| 1174 | D1({ | 1174 | D1({ |
| 1175 | int len = dentry->d_name.len; | 1175 | int len = dentry->d_name.len; |
| 1176 | char *_name = (char *)kmalloc(len + 1, GFP_KERNEL); | 1176 | char *_name = kmalloc(len + 1, GFP_KERNEL); |
| 1177 | char *_symname = (char *)kmalloc(symname_len + 1, GFP_KERNEL); | 1177 | char *_symname = kmalloc(symname_len + 1, GFP_KERNEL); |
| 1178 | memcpy(_name, dentry->d_name.name, len); | 1178 | memcpy(_name, dentry->d_name.name, len); |
| 1179 | _name[len] = '\0'; | 1179 | _name[len] = '\0'; |
| 1180 | memcpy(_symname, symname, symname_len); | 1180 | memcpy(_symname, symname, symname_len); |
| @@ -1282,7 +1282,7 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
| 1282 | lock_kernel(); | 1282 | lock_kernel(); |
| 1283 | D1({ | 1283 | D1({ |
| 1284 | int len = dentry->d_name.len; | 1284 | int len = dentry->d_name.len; |
| 1285 | char *s = (char *)kmalloc(len + 1, GFP_KERNEL); | 1285 | char *s = kmalloc(len + 1, GFP_KERNEL); |
| 1286 | memcpy(s, dentry->d_name.name, len); | 1286 | memcpy(s, dentry->d_name.name, len); |
| 1287 | s[len] = '\0'; | 1287 | s[len] = '\0'; |
| 1288 | printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s); | 1288 | printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s); |
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index 9000f1effedf..4a543e114970 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
| @@ -488,13 +488,11 @@ jffs_create_file(struct jffs_control *c, | |||
| 488 | { | 488 | { |
| 489 | struct jffs_file *f; | 489 | struct jffs_file *f; |
| 490 | 490 | ||
| 491 | if (!(f = (struct jffs_file *)kmalloc(sizeof(struct jffs_file), | 491 | if (!(f = kzalloc(sizeof(*f), GFP_KERNEL))) { |
| 492 | GFP_KERNEL))) { | ||
| 493 | D(printk("jffs_create_file(): Failed!\n")); | 492 | D(printk("jffs_create_file(): Failed!\n")); |
| 494 | return NULL; | 493 | return NULL; |
| 495 | } | 494 | } |
| 496 | no_jffs_file++; | 495 | no_jffs_file++; |
| 497 | memset(f, 0, sizeof(struct jffs_file)); | ||
| 498 | f->ino = raw_inode->ino; | 496 | f->ino = raw_inode->ino; |
| 499 | f->pino = raw_inode->pino; | 497 | f->pino = raw_inode->pino; |
| 500 | f->nlink = raw_inode->nlink; | 498 | f->nlink = raw_inode->nlink; |
| @@ -516,7 +514,7 @@ jffs_create_control(struct super_block *sb) | |||
| 516 | 514 | ||
| 517 | D2(printk("jffs_create_control()\n")); | 515 | D2(printk("jffs_create_control()\n")); |
| 518 | 516 | ||
| 519 | if (!(c = (struct jffs_control *)kmalloc(s, GFP_KERNEL))) { | 517 | if (!(c = kmalloc(s, GFP_KERNEL))) { |
| 520 | goto fail_control; | 518 | goto fail_control; |
| 521 | } | 519 | } |
| 522 | DJM(no_jffs_control++); | 520 | DJM(no_jffs_control++); |
| @@ -524,7 +522,7 @@ jffs_create_control(struct super_block *sb) | |||
| 524 | c->gc_task = NULL; | 522 | c->gc_task = NULL; |
| 525 | c->hash_len = JFFS_HASH_SIZE; | 523 | c->hash_len = JFFS_HASH_SIZE; |
| 526 | s = sizeof(struct list_head) * c->hash_len; | 524 | s = sizeof(struct list_head) * c->hash_len; |
| 527 | if (!(c->hash = (struct list_head *)kmalloc(s, GFP_KERNEL))) { | 525 | if (!(c->hash = kmalloc(s, GFP_KERNEL))) { |
| 528 | goto fail_hash; | 526 | goto fail_hash; |
| 529 | } | 527 | } |
| 530 | DJM(no_hash++); | 528 | DJM(no_hash++); |
| @@ -593,8 +591,7 @@ jffs_add_virtual_root(struct jffs_control *c) | |||
| 593 | D2(printk("jffs_add_virtual_root(): " | 591 | D2(printk("jffs_add_virtual_root(): " |
| 594 | "Creating a virtual root directory.\n")); | 592 | "Creating a virtual root directory.\n")); |
| 595 | 593 | ||
| 596 | if (!(root = (struct jffs_file *)kmalloc(sizeof(struct jffs_file), | 594 | if (!(root = kmalloc(sizeof(struct jffs_file), GFP_KERNEL))) { |
| 597 | GFP_KERNEL))) { | ||
| 598 | return -ENOMEM; | 595 | return -ENOMEM; |
| 599 | } | 596 | } |
| 600 | no_jffs_file++; | 597 | no_jffs_file++; |
diff --git a/fs/jffs/jffs_fm.c b/fs/jffs/jffs_fm.c index 7d8ca1aeace2..29b68d939bd9 100644 --- a/fs/jffs/jffs_fm.c +++ b/fs/jffs/jffs_fm.c | |||
| @@ -94,8 +94,7 @@ jffs_build_begin(struct jffs_control *c, int unit) | |||
| 94 | struct mtd_info *mtd; | ||
