Commit 45cfbe35 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds

fat: Cleanup msdos_lookup()

Use same style with vfat_lookup().
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1c13a243
...@@ -203,33 +203,37 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry, ...@@ -203,33 +203,37 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
struct inode *inode = NULL; struct inode *inode;
int res; int err;
dentry->d_op = &msdos_dentry_operations;
lock_super(sb); lock_super(sb);
res = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
if (res == -ENOENT) err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
goto add; if (err) {
if (res < 0) if (err == -ENOENT) {
inode = NULL;
goto out; goto out;
}
goto error;
}
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh); brelse(sinfo.bh);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
res = PTR_ERR(inode); err = PTR_ERR(inode);
goto out; goto error;
} }
add: out:
res = 0; unlock_super(sb);
dentry->d_op = &msdos_dentry_operations;
dentry = d_splice_alias(inode, dentry); dentry = d_splice_alias(inode, dentry);
if (dentry) if (dentry)
dentry->d_op = &msdos_dentry_operations; dentry->d_op = &msdos_dentry_operations;
out:
unlock_super(sb);
if (!res)
return dentry; return dentry;
return ERR_PTR(res);
error:
unlock_super(sb);
return ERR_PTR(err);
} }
/***** Creates a directory entry (name is already formatted). */ /***** Creates a directory entry (name is already formatted). */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment