]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ntsync: Return the fd from NTSYNC_IOC_CREATE_SEM.
authorElizabeth Figura <zfigura@codeweavers.com>
Fri, 13 Dec 2024 19:34:42 +0000 (13:34 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Jan 2025 12:18:10 +0000 (13:18 +0100)
Simplify the user API a bit by returning the fd as return value from the ioctl
instead of through the argument pointer.

Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
Link: https://lore.kernel.org/r/20241213193511.457338-2-zfigura@codeweavers.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/ntsync.c
include/uapi/linux/ntsync.h

index 4954553b7baa6f6788057cb872f2d57483d7be6d..2e7f698268c1f96695b0bcb59d2fadcf27538b6a 100644 (file)
@@ -165,7 +165,6 @@ static int ntsync_obj_get_fd(struct ntsync_obj *obj)
 
 static int ntsync_create_sem(struct ntsync_device *dev, void __user *argp)
 {
-       struct ntsync_sem_args __user *user_args = argp;
        struct ntsync_sem_args args;
        struct ntsync_obj *sem;
        int fd;
@@ -182,12 +181,10 @@ static int ntsync_create_sem(struct ntsync_device *dev, void __user *argp)
        sem->u.sem.count = args.count;
        sem->u.sem.max = args.max;
        fd = ntsync_obj_get_fd(sem);
-       if (fd < 0) {
+       if (fd < 0)
                kfree(sem);
-               return fd;
-       }
 
-       return put_user(fd, &user_args->sem);
+       return fd;
 }
 
 static int ntsync_char_open(struct inode *inode, struct file *file)
index dcfa38fdc93c61271b602ee6c2052d7f98d03662..27d8cb3dd5b7c88f34a1c9dba3d27c97d580f465 100644 (file)
 #include <linux/types.h>
 
 struct ntsync_sem_args {
-       __u32 sem;
        __u32 count;
        __u32 max;
 };
 
-#define NTSYNC_IOC_CREATE_SEM          _IOWR('N', 0x80, struct ntsync_sem_args)
+#define NTSYNC_IOC_CREATE_SEM          _IOW ('N', 0x80, struct ntsync_sem_args)
 
 #define NTSYNC_IOC_SEM_POST            _IOWR('N', 0x81, __u32)