diff options
Diffstat (limited to 'drivers/usb/misc/usblcd.c')
-rw-r--r-- | drivers/usb/misc/usblcd.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index c82c402285a0..dbaca9f1efad 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -200,10 +200,8 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz | |||
200 | 200 | ||
201 | /* create a urb, and a buffer for it, and copy the data to the urb */ | 201 | /* create a urb, and a buffer for it, and copy the data to the urb */ |
202 | urb = usb_alloc_urb(0, GFP_KERNEL); | 202 | urb = usb_alloc_urb(0, GFP_KERNEL); |
203 | if (!urb) { | 203 | if (!urb) |
204 | retval = -ENOMEM; | 204 | return -ENOMEM; |
205 | goto error; | ||
206 | } | ||
207 | 205 | ||
208 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); | 206 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); |
209 | if (!buf) { | 207 | if (!buf) { |
@@ -241,7 +239,7 @@ error: | |||
241 | return retval; | 239 | return retval; |
242 | } | 240 | } |
243 | 241 | ||
244 | static struct file_operations lcd_fops = { | 242 | static const struct file_operations lcd_fops = { |
245 | .owner = THIS_MODULE, | 243 | .owner = THIS_MODULE, |
246 | .read = lcd_read, | 244 | .read = lcd_read, |
247 | .write = lcd_write, | 245 | .write = lcd_write, |
@@ -292,9 +290,7 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id | |||
292 | endpoint = &iface_desc->endpoint[i].desc; | 290 | endpoint = &iface_desc->endpoint[i].desc; |
293 | 291 | ||
294 | if (!dev->bulk_in_endpointAddr && | 292 | if (!dev->bulk_in_endpointAddr && |
295 | (endpoint->bEndpointAddress & USB_DIR_IN) && | 293 | usb_endpoint_is_bulk_in(endpoint)) { |
296 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
297 | == USB_ENDPOINT_XFER_BULK)) { | ||
298 | /* we found a bulk in endpoint */ | 294 | /* we found a bulk in endpoint */ |
299 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); | 295 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); |
300 | dev->bulk_in_size = buffer_size; | 296 | dev->bulk_in_size = buffer_size; |
@@ -307,9 +303,7 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id | |||
307 | } | 303 | } |
308 | 304 | ||
309 | if (!dev->bulk_out_endpointAddr && | 305 | if (!dev->bulk_out_endpointAddr && |
310 | !(endpoint->bEndpointAddress & USB_DIR_IN) && | 306 | usb_endpoint_is_bulk_out(endpoint)) { |
311 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
312 | == USB_ENDPOINT_XFER_BULK)) { | ||
313 | /* we found a bulk out endpoint */ | 307 | /* we found a bulk out endpoint */ |
314 | dev->bulk_out_endpointAddr = endpoint->bEndpointAddress; | 308 | dev->bulk_out_endpointAddr = endpoint->bEndpointAddress; |
315 | } | 309 | } |