diff options
-rw-r--r-- | drivers/usb/misc/idmouse.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 3944a55ed74c..1dc3e0f73014 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c | |||
@@ -319,20 +319,8 @@ static ssize_t idmouse_read(struct file *file, char __user *buffer, size_t count | |||
319 | return -ENODEV; | 319 | return -ENODEV; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (*ppos >= IMGSIZE) { | 322 | result = simple_read_from_buffer(buffer, count, ppos, |
323 | up (&dev->sem); | 323 | dev->bulk_in_buffer, IMGSIZE); |
324 | return 0; | ||
325 | } | ||
326 | |||
327 | count = min ((loff_t)count, IMGSIZE - (*ppos)); | ||
328 | |||
329 | if (copy_to_user (buffer, dev->bulk_in_buffer + *ppos, count)) { | ||
330 | result = -EFAULT; | ||
331 | } else { | ||
332 | result = count; | ||
333 | *ppos += count; | ||
334 | } | ||
335 | |||
336 | /* unlock the device */ | 324 | /* unlock the device */ |
337 | up(&dev->sem); | 325 | up(&dev->sem); |
338 | return result; | 326 | return result; |