diff options
author | Keith Packard <keithp@keithp.com> | 2015-03-26 19:49:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-01 08:00:11 -0400 |
commit | 8b86ed078a65433a60ff59091a136d23724bd6d3 (patch) | |
tree | 1421952dd183bcef376938c8c8b35efca85a60b7 /drivers/usb/misc | |
parent | f4ea80a6026a09aa0b59ec7443b901660f390550 (diff) |
usb: Fix warnings in chaoskey driver
> drivers/usb/misc/chaoskey.c: In function 'chaoskey_read':
> >> drivers/usb/misc/chaoskey.c:412:3: error: implicit declaration of function 'copy_to_user'
> >> [-Werror=implicit-function-declaration]
> remain = copy_to_user(buffer, dev->buf + dev->used, this_time);
I was unable to reproduce this locally, but added an explicit
#include <linux/uaccess.h>
which should ensure the definition on all architectures.
> sparse warnings: (new ones prefixed by >>)
>
> >> drivers/usb/misc/chaoskey.c:117:30: sparse: incorrect type in assignment (different base types)
> drivers/usb/misc/chaoskey.c:117:30: expected int [signed] size
> drivers/usb/misc/chaoskey.c:117:30: got restricted __le16 [usertype] wMaxPacketSize
Switched the code to using the USB descriptor accessor functions.
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/chaoskey.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c index ef80ce9452a4..3ad5d19e4d04 100644 --- a/drivers/usb/misc/chaoskey.c +++ b/drivers/usb/misc/chaoskey.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
29 | #include <linux/hw_random.h> | 29 | #include <linux/hw_random.h> |
30 | #include <linux/mutex.h> | ||
31 | #include <linux/uaccess.h> | ||
30 | 32 | ||
31 | static struct usb_driver chaoskey_driver; | 33 | static struct usb_driver chaoskey_driver; |
32 | static struct usb_class_driver chaoskey_class; | 34 | static struct usb_class_driver chaoskey_class; |
@@ -113,8 +115,8 @@ static int chaoskey_probe(struct usb_interface *interface, | |||
113 | /* Find the first bulk IN endpoint and its packet size */ | 115 | /* Find the first bulk IN endpoint and its packet size */ |
114 | for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { | 116 | for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { |
115 | if (usb_endpoint_is_bulk_in(&altsetting->endpoint[i].desc)) { | 117 | if (usb_endpoint_is_bulk_in(&altsetting->endpoint[i].desc)) { |
116 | in_ep = altsetting->endpoint[i].desc.bEndpointAddress; | 118 | in_ep = usb_endpoint_num(&altsetting->endpoint[i].desc); |
117 | size = altsetting->endpoint[i].desc.wMaxPacketSize; | 119 | size = usb_endpoint_maxp(&altsetting->endpoint[i].desc); |
118 | break; | 120 | break; |
119 | } | 121 | } |
120 | } | 122 | } |