diff options
Diffstat (limited to 'fs/jffs/intrep.c')
| -rw-r--r-- | fs/jffs/intrep.c | 11 |
1 files changed, 4 insertions, 7 deletions
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++; |
