aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-20 07:09:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-13 18:44:05 -0400
commit485707116b3949ab41e1aba8d74f45a7551e3a65 (patch)
treeb78a9ca59b2c2e930d61f96d94194ee66811fdc8 /drivers/usb
parent9ab7927bb845cf2549110b19c212fe44a2bfbacb (diff)
usb: pch_udc: unlock on allocation failure
There was an unlock missing on the error path. Also I did a small cleanup by changing ep->dev->lock for just dev->lock. They're the same lock, but dev->lock is shorter and that's how it is used for the spin_unlock_irqrestore() call. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/pch_udc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 3e4b35e50c2..68dbcc3e4cc 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -1608,7 +1608,7 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
1608 return -EINVAL; 1608 return -EINVAL;
1609 if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) 1609 if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN))
1610 return -ESHUTDOWN; 1610 return -ESHUTDOWN;
1611 spin_lock_irqsave(&ep->dev->lock, iflags); 1611 spin_lock_irqsave(&dev->lock, iflags);
1612 /* map the buffer for dma */ 1612 /* map the buffer for dma */
1613 if (usbreq->length && 1613 if (usbreq->length &&
1614 ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { 1614 ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) {
@@ -1625,8 +1625,10 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
1625 DMA_FROM_DEVICE); 1625 DMA_FROM_DEVICE);
1626 } else { 1626 } else {
1627 req->buf = kzalloc(usbreq->length, GFP_ATOMIC); 1627 req->buf = kzalloc(usbreq->length, GFP_ATOMIC);
1628 if (!req->buf) 1628 if (!req->buf) {
1629 return -ENOMEM; 1629 retval = -ENOMEM;
1630 goto probe_end;
1631 }
1630 if (ep->in) { 1632 if (ep->in) {
1631 memcpy(req->buf, usbreq->buf, usbreq->length); 1633 memcpy(req->buf, usbreq->buf, usbreq->length);
1632 req->dma = dma_map_single(&dev->pdev->dev, 1634 req->dma = dma_map_single(&dev->pdev->dev,