[PATCH][2/2] isofs: kfree handles NULL pointers fine (inode.c)

From: Jesper Juhl
Date: Wed Mar 16 2005 - 17:58:56 EST



kfree() has no trouble being handed a NULL pointer, so checking for one
before calling it is redundant. This patch removes the redundant checks in
fs/isofs/inode.c


Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.11-mm4-orig/fs/isofs/inode.c linux-2.6.11-mm4/fs/isofs/inode.c
--- linux-2.6.11-mm4-orig/fs/isofs/inode.c 2005-03-02 08:38:26.000000000 +0100
+++ linux-2.6.11-mm4/fs/isofs/inode.c 2005-03-16 23:46:35.000000000 +0100
@@ -863,8 +863,7 @@ root_found:
if (opt.check == 'r') table++;
s->s_root->d_op = &isofs_dentry_ops[table];

- if (opt.iocharset)
- kfree(opt.iocharset);
+ kfree(opt.iocharset);

return 0;

@@ -903,8 +902,7 @@ out_unknown_format:
out_freebh:
brelse(bh);
out_freesbi:
- if (opt.iocharset)
- kfree(opt.iocharset);
+ kfree(opt.iocharset);
kfree(sbi);
s->s_fs_info = NULL;
return -EINVAL;
@@ -1163,8 +1161,7 @@ static int isofs_read_level3_size(struct
goto out_toomany;
} while(more_entries);
out:
- if (tmpde)
- kfree(tmpde);
+ kfree(tmpde);
if (bh)
brelse(bh);
return 0;
@@ -1176,8 +1173,7 @@ out_nomem:

out_noread:
printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block);
- if (tmpde)
- kfree(tmpde);
+ kfree(tmpde);
return -EIO;

out_toomany:
@@ -1346,8 +1342,7 @@ static void isofs_read_inode(struct inod
init_special_inode(inode, inode->i_mode, inode->i_rdev);

out:
- if (tmpde)
- kfree(tmpde);
+ kfree(tmpde);
if (bh)
brelse(bh);
return;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/