--- zzzz-none-000/linux-3.10.107/drivers/usb/misc/yurex.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/misc/yurex.c 2021-02-04 17:41:59.000000000 +0000 @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -297,6 +296,7 @@ /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); + dev->bbu = -1; /* we can register the device now, as it is ready */ retval = usb_register_dev(interface, &yurex_class); @@ -307,8 +307,6 @@ goto error; } - dev->bbu = -1; - dev_info(&interface->dev, "USB YUREX device now attached to Yurex #%d\n", interface->minor); @@ -360,7 +358,7 @@ { struct usb_yurex *dev; - dev = (struct usb_yurex *)file->private_data; + dev = file->private_data; return fasync_helper(fd, file, on, &dev->async_queue); } @@ -403,7 +401,7 @@ { struct usb_yurex *dev; - dev = (struct usb_yurex *)file->private_data; + dev = file->private_data; if (dev == NULL) return -ENODEV; @@ -412,7 +410,8 @@ return 0; } -static ssize_t yurex_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, + loff_t *ppos) { struct usb_yurex *dev; int retval = 0; @@ -420,7 +419,7 @@ char in_buffer[20]; unsigned long flags; - dev = (struct usb_yurex *)file->private_data; + dev = file->private_data; mutex_lock(&dev->io_mutex); if (!dev->interface) { /* already disconnected */ @@ -446,7 +445,8 @@ return retval; } -static ssize_t yurex_write(struct file *file, const char *user_buffer, size_t count, loff_t *ppos) +static ssize_t yurex_write(struct file *file, const char __user *user_buffer, + size_t count, loff_t *ppos) { struct usb_yurex *dev; int i, set = 0, retval = 0; @@ -457,14 +457,14 @@ DEFINE_WAIT(wait); count = min(sizeof(buffer), count); - dev = (struct usb_yurex *)file->private_data; + dev = file->private_data; /* verify that we actually have some data to write */ if (count == 0) goto error; mutex_lock(&dev->io_mutex); - if (!dev->interface) { /* alreaday disconnected */ + if (!dev->interface) { /* already disconnected */ mutex_unlock(&dev->io_mutex); retval = -ENODEV; goto error;