Skip to content

Commit

Permalink
clean erofs_lookup()
Browse files Browse the repository at this point in the history
d_splice_alias() does the right thing when given
ERR_PTR(-E...) for inode.  No need for gotos, multiple
returns, etc. in there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Oct 10, 2018
1 parent 5b394b2 commit 8300807
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions drivers/staging/erofs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir,
if (err == -ENOENT) {
/* negative dentry */
inode = NULL;
goto negative_out;
} else if (unlikely(err))
return ERR_PTR(err);

debugln("%s, %s (nid %llu) found, d_type %u", __func__,
dentry->d_name.name, nid, d_type);

inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
if (IS_ERR(inode))
return ERR_CAST(inode);

negative_out:
} else if (unlikely(err)) {
inode = ERR_PTR(err);
} else {
debugln("%s, %s (nid %llu) found, d_type %u", __func__,
dentry->d_name.name, nid, d_type);
inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
}
return d_splice_alias(inode, dentry);
}

Expand Down

0 comments on commit 8300807

Please sign in to comment.