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 /fs/jffs | |
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>
Diffstat (limited to 'fs/jffs')
-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 |
3 files changed, 10 insertions, 15 deletions
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; | 94 | struct mtd_info *mtd; |
95 | 95 | ||
96 | D3(printk("jffs_build_begin()\n")); | 96 | D3(printk("jffs_build_begin()\n")); |
97 | fmc = (struct jffs_fmcontrol *)kmalloc(sizeof(struct jffs_fmcontrol), | 97 | fmc = kmalloc(sizeof(*fmc), GFP_KERNEL); |
98 | GFP_KERNEL); | ||
99 | if (!fmc) { | 98 | if (!fmc) { |
100 | D(printk("jffs_build_begin(): Allocation of " | 99 | D(printk("jffs_build_begin(): Allocation of " |
101 | "struct jffs_fmcontrol failed!\n")); | 100 | "struct jffs_fmcontrol failed!\n")); |
@@ -486,8 +485,7 @@ jffs_add_node(struct jffs_node *node) | |||
486 | 485 | ||
487 | D3(printk("jffs_add_node(): ino = %u\n", node->ino)); | 486 | D3(printk("jffs_add_node(): ino = %u\n", node->ino)); |
488 | 487 | ||
489 | ref = (struct jffs_node_ref *)kmalloc(sizeof(struct jffs_node_ref), | 488 | ref = kmalloc(sizeof(*ref), GFP_KERNEL); |
490 | GFP_KERNEL); | ||
491 | if (!ref) | 489 | if (!ref) |
492 | return -ENOMEM; | 490 | return -ENOMEM; |
493 | 491 | ||