]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spufs: convert spufs_context_open() to FD_PREPARE()
authorChristian Brauner <brauner@kernel.org>
Sun, 23 Nov 2025 16:33:50 +0000 (17:33 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 28 Nov 2025 11:42:34 +0000 (12:42 +0100)
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-32-b6efa1706cfd@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
arch/powerpc/platforms/cell/spufs/inode.c

index 7ec60290abe640b30457915773d776b38e88c827..1953223937094bf29566e548c36c9df28852de66 100644 (file)
@@ -267,22 +267,11 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
 
 static int spufs_context_open(const struct path *path)
 {
-       int ret;
-       struct file *filp;
-
-       ret = get_unused_fd_flags(0);
-       if (ret < 0)
-               return ret;
-
-       filp = dentry_open(path, O_RDONLY, current_cred());
-       if (IS_ERR(filp)) {
-               put_unused_fd(ret);
-               return PTR_ERR(filp);
-       }
-
-       filp->f_op = &spufs_context_fops;
-       fd_install(ret, filp);
-       return ret;
+       FD_PREPARE(fdf, 0, dentry_open(path, O_RDONLY, current_cred()));
+       if (fdf.err)
+               return fdf.err;
+       fd_prepare_file(fdf)->f_op = &spufs_context_fops;
+       return fd_publish(fdf);
 }
 
 static struct spu_context *