ntsync: convert ntsync_obj_get_fd() to FD_PREPARE()
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-41-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>pull/1354/merge
parent
6f504cbf10
commit
af66279a01
|
|
@ -721,21 +721,12 @@ static struct ntsync_obj *ntsync_alloc_obj(struct ntsync_device *dev,
|
||||||
|
|
||||||
static int ntsync_obj_get_fd(struct ntsync_obj *obj)
|
static int ntsync_obj_get_fd(struct ntsync_obj *obj)
|
||||||
{
|
{
|
||||||
struct file *file;
|
FD_PREPARE(fdf, O_CLOEXEC,
|
||||||
int fd;
|
anon_inode_getfile("ntsync", &ntsync_obj_fops, obj, O_RDWR));
|
||||||
|
if (fdf.err)
|
||||||
fd = get_unused_fd_flags(O_CLOEXEC);
|
return fdf.err;
|
||||||
if (fd < 0)
|
obj->file = fd_prepare_file(fdf);
|
||||||
return fd;
|
return fd_publish(fdf);
|
||||||
file = anon_inode_getfile("ntsync", &ntsync_obj_fops, obj, O_RDWR);
|
|
||||||
if (IS_ERR(file)) {
|
|
||||||
put_unused_fd(fd);
|
|
||||||
return PTR_ERR(file);
|
|
||||||
}
|
|
||||||
obj->file = file;
|
|
||||||
fd_install(fd, file);
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ntsync_create_sem(struct ntsync_device *dev, void __user *argp)
|
static int ntsync_create_sem(struct ntsync_device *dev, void __user *argp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue