summaryrefslogtreecommitdiff
path: root/fs/hfs/dir.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-04-30 19:51:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-05-22 14:27:59 -0400
commit6b9cceead0d1fc478fbc25a7d8d8f006d061a1a2 (patch)
tree2d0674a495d9ebf91dcf5cd2a265522b88c14c46 /fs/hfs/dir.c
parent18fbbfc2bfab4c45074bddb16c478b4366a265d5 (diff)
downloadlwn-6b9cceead0d1fc478fbc25a7d8d8f006d061a1a2.tar.gz
lwn-6b9cceead0d1fc478fbc25a7d8d8f006d061a1a2.zip
hfs: use d_splice_alias()
code is simpler that way Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hfs/dir.c')
-rw-r--r--fs/hfs/dir.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 75b254280ff6..3bf2ae0e467c 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -31,21 +31,15 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name);
res = hfs_brec_read(&fd, &rec, sizeof(rec));
if (res) {
- hfs_find_exit(&fd);
- if (res == -ENOENT) {
- /* No such entry */
- inode = NULL;
- goto done;
- }
- return ERR_PTR(res);
+ if (res != -ENOENT)
+ inode = ERR_PTR(res);
+ } else {
+ inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);
+ if (!inode)
+ inode = ERR_PTR(-EACCES);
}
- inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);
hfs_find_exit(&fd);
- if (!inode)
- return ERR_PTR(-EACCES);
-done:
- d_add(dentry, inode);
- return NULL;
+ return d_splice_alias(inode, dentry);
}
/*