From: Colin Ian King Date: Tue, 20 Dec 2016 16:18:37 +0000 (+0000) Subject: btrfs: remove redundant inode null check X-Git-Tag: v5.15~11466^2~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=694a0dee9c2d36a552f31a1b104733ed3f90f46d;p=platform%2Fkernel%2Flinux-starfive.git btrfs: remove redundant inode null check The check for a null inode is redundant since the function is a callback for exportfs, which will itself crash if dentry->d_inode or parent->d_inode is NULL. Removing the null check makes this consistent with other file systems. Also remove the redundant null dir check too. Found with static analysis by CoverityScan, CID 1389472 Kudos to Jeff Mahoney for reviewing and explaining the error in my original patch (most of this explanation went into the above commit message) and David Sterba for pointing out that the dir check is also redundant. Signed-off-by: Colin Ian King Signed-off-by: David Sterba --- diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 340d9075..4f77431 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -235,9 +235,6 @@ static int btrfs_get_name(struct dentry *parent, char *name, int ret; u64 ino; - if (!dir || !inode) - return -EINVAL; - if (!S_ISDIR(dir->i_mode)) return -EINVAL;