Skip to content

Commit bf349a4

Browse files
author
Al Viro
committed
spufs: shift dget/mntget towards dentry_open()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 3b6456d commit bf349a4

File tree

1 file changed

+18
-28
lines changed
  • arch/powerpc/platforms/cell/spufs

1 file changed

+18
-28
lines changed

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -323,22 +323,21 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
323323
struct file *filp;
324324

325325
ret = get_unused_fd();
326-
if (ret < 0) {
327-
dput(dentry);
328-
mntput(mnt);
329-
goto out;
330-
}
326+
if (ret < 0)
327+
return ret;
331328

332-
filp = dentry_open(dentry, mnt, O_RDONLY, current_cred());
329+
/*
330+
* get references for dget and mntget, will be released
331+
* in error path of *_open().
332+
*/
333+
filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred());
333334
if (IS_ERR(filp)) {
334335
put_unused_fd(ret);
335-
ret = PTR_ERR(filp);
336-
goto out;
336+
return PTR_ERR(filp);
337337
}
338338

339339
filp->f_op = &spufs_context_fops;
340340
fd_install(ret, filp);
341-
out:
342341
return ret;
343342
}
344343

@@ -495,11 +494,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
495494
put_spu_context(neighbor);
496495
}
497496

498-
/*
499-
* get references for dget and mntget, will be released
500-
* in error path of *_open().
501-
*/
502-
ret = spufs_context_open(dget(dentry), mntget(mnt));
497+
ret = spufs_context_open(dentry, mnt);
503498
if (ret < 0) {
504499
WARN_ON(spufs_rmdir(inode, dentry));
505500
if (affinity)
@@ -562,22 +557,21 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
562557
struct file *filp;
563558

564559
ret = get_unused_fd();
565-
if (ret < 0) {
566-
dput(dentry);
567-
mntput(mnt);
568-
goto out;
569-
}
560+
if (ret < 0)
561+
return ret;
570562

571-
filp = dentry_open(dentry, mnt, O_RDONLY, current_cred());
563+
/*
564+
* get references for dget and mntget, will be released
565+
* in error path of *_open().
566+
*/
567+
filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred());
572568
if (IS_ERR(filp)) {
573569
put_unused_fd(ret);
574-
ret = PTR_ERR(filp);
575-
goto out;
570+
return PTR_ERR(filp);
576571
}
577572

578573
filp->f_op = &simple_dir_operations;
579574
fd_install(ret, filp);
580-
out:
581575
return ret;
582576
}
583577

@@ -591,11 +585,7 @@ static int spufs_create_gang(struct inode *inode,
591585
if (ret)
592586
goto out;
593587

594-
/*
595-
* get references for dget and mntget, will be released
596-
* in error path of *_open().
597-
*/
598-
ret = spufs_gang_open(dget(dentry), mntget(mnt));
588+
ret = spufs_gang_open(dentry, mnt);
599589
if (ret < 0) {
600590
int err = simple_rmdir(inode, dentry);
601591
WARN_ON(err);

0 commit comments

Comments
 (0)