]> git.baikalelectronics.ru Git - kernel.git/commitdiff
simplify btrfs_lookup()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 10 Oct 2018 20:38:27 +0000 (16:38 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 10 Oct 2018 20:38:27 +0000 (16:38 -0400)
d_splice_alias() is fine with ERR_PTR(-E...) for inode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/btrfs/inode.c

index 9357a19d2bff2c76de1b29d2e221333b6f76da7e..fb688c4aa34fc9100a3595a57b099b86dc1c5e39 100644 (file)
@@ -5807,16 +5807,10 @@ static int btrfs_dentry_delete(const struct dentry *dentry)
 static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
                                   unsigned int flags)
 {
-       struct inode *inode;
-
-       inode = btrfs_lookup_dentry(dir, dentry);
-       if (IS_ERR(inode)) {
-               if (PTR_ERR(inode) == -ENOENT)
-                       inode = NULL;
-               else
-                       return ERR_CAST(inode);
-       }
+       struct inode *inode = btrfs_lookup_dentry(dir, dentry);
 
+       if (inode == ERR_PTR(-ENOENT))
+               inode = NULL;
        return d_splice_alias(inode, dentry);
 }