Skip to content

Commit 0b9d4a6

Browse files
committed
spufs: convert spufs_gang_open() to FD_PREPARE()
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-34-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 6d3789d commit 0b9d4a6

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

  • arch/powerpc/platforms/cell/spufs

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -497,26 +497,15 @@ static const struct file_operations spufs_gang_fops = {
497497

498498
static int spufs_gang_open(const struct path *path)
499499
{
500-
int ret;
501-
struct file *filp;
502-
503-
ret = get_unused_fd_flags(0);
504-
if (ret < 0)
505-
return ret;
506-
507500
/*
508501
* get references for dget and mntget, will be released
509502
* in error path of *_open().
510503
*/
511-
filp = dentry_open(path, O_RDONLY, current_cred());
512-
if (IS_ERR(filp)) {
513-
put_unused_fd(ret);
514-
return PTR_ERR(filp);
515-
}
516-
517-
filp->f_op = &spufs_gang_fops;
518-
fd_install(ret, filp);
519-
return ret;
504+
FD_PREPARE(fdf, 0, dentry_open(path, O_RDONLY, current_cred()));
505+
if (fdf.err)
506+
return fdf.err;
507+
fd_prepare_file(fdf)->f_op = &spufs_gang_fops;
508+
return fd_publish(fdf);
520509
}
521510

522511
static int spufs_create_gang(struct inode *inode,

0 commit comments

Comments
 (0)