aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/visor.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:19:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:19:17 -0400
commit50f732ee63b91eb08a29974b36bd63e1150bb642 (patch)
treefdfc63411a34ffbe26a3b0a997aaeff742a0301b /drivers/usb/serial/visor.c
parentaa5bc2b58e3344da57f26b62e99e13e91c9e0a94 (diff)
parenta7205b30106a2d4ee268132644cdb292da2d9b41 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (78 commits) USB: update MAINAINERS and CREDITS for Freescale USB driver USB: update gadget files for fsl_usb2_udc driver USB: add Freescale high-speed USB SOC device controller driver USB: quirk for broken suspend of IT8152F/G USB: iowarrior.c: timeouts too small in usb_control_msg calls USB: dell device id for option.c USB: Remove Huawei unusual_devs entry USB: CP2101 New Device IDs USB: add picdem device to ldusb usbfs micro optimitation USB: remove ancient/broken CRIS hcd usb ethernet gadget, workaround network stack API glitch USB: add "busnum" attribute for USB devices USB: cxacru: ADSL state management usbatm: Detect usb device shutdown and ignore failed urbs USB: Remove duplicate define of OHCI_QUIRK_ZFMICRO USB: BandRich BandLuxe HSDPA Data Card Driver USB gadget rndis: fix struct rndis_packet_msg_type unaligned bug USB Elan FTDI: check for driver registration status USB: sierra: add more checks on shutdown ...
Diffstat (limited to 'drivers/usb/serial/visor.c')
-rw-r--r--drivers/usb/serial/visor.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 2f59ff226e2c..ffbe601cde2a 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -384,19 +384,21 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf,
384 dbg("%s - write limit hit\n", __FUNCTION__); 384 dbg("%s - write limit hit\n", __FUNCTION__);
385 return 0; 385 return 0;
386 } 386 }
387 priv->outstanding_urbs++;
387 spin_unlock_irqrestore(&priv->lock, flags); 388 spin_unlock_irqrestore(&priv->lock, flags);
388 389
389 buffer = kmalloc (count, GFP_ATOMIC); 390 buffer = kmalloc (count, GFP_ATOMIC);
390 if (!buffer) { 391 if (!buffer) {
391 dev_err(&port->dev, "out of memory\n"); 392 dev_err(&port->dev, "out of memory\n");
392 return -ENOMEM; 393 count = -ENOMEM;
394 goto error_no_buffer;
393 } 395 }
394 396
395 urb = usb_alloc_urb(0, GFP_ATOMIC); 397 urb = usb_alloc_urb(0, GFP_ATOMIC);
396 if (!urb) { 398 if (!urb) {
397 dev_err(&port->dev, "no more free urbs\n"); 399 dev_err(&port->dev, "no more free urbs\n");
398 kfree (buffer); 400 count = -ENOMEM;
399 return -ENOMEM; 401 goto error_no_urb;
400 } 402 }
401 403
402 memcpy (buffer, buf, count); 404 memcpy (buffer, buf, count);
@@ -415,19 +417,27 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf,
415 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", 417 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n",
416 __FUNCTION__, status); 418 __FUNCTION__, status);
417 count = status; 419 count = status;
418 kfree (buffer); 420 goto error;
419 } else { 421 } else {
420 spin_lock_irqsave(&priv->lock, flags); 422 spin_lock_irqsave(&priv->lock, flags);
421 ++priv->outstanding_urbs;
422 priv->bytes_out += count; 423 priv->bytes_out += count;
423 spin_unlock_irqrestore(&priv->lock, flags); 424 spin_unlock_irqrestore(&priv->lock, flags);
424 } 425 }
425 426
426 /* we are done with this urb, so let the host driver 427 /* we are done with this urb, so let the host driver
427 * really free it when it is finished with it */ 428 * really free it when it is finished with it */
428 usb_free_urb (urb); 429 usb_free_urb(urb);
429 430
430 return count; 431 return count;
432error:
433 usb_free_urb(urb);
434error_no_urb:
435 kfree(buffer);
436error_no_buffer:
437 spin_lock_irqsave(&priv->lock, flags);
438 --priv->outstanding_urbs;
439 spin_unlock_irqrestore(&priv->lock, flags);
440 return count;
431} 441}
432 442
433 443