mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
9ab7927bb8
commit
485707116b
|
@ -1608,7 +1608,7 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN))
|
if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN))
|
||||||
return -ESHUTDOWN;
|
return -ESHUTDOWN;
|
||||||
spin_lock_irqsave(&ep->dev->lock, iflags);
|
spin_lock_irqsave(&dev->lock, iflags);
|
||||||
/* map the buffer for dma */
|
/* map the buffer for dma */
|
||||||
if (usbreq->length &&
|
if (usbreq->length &&
|
||||||
((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) {
|
((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,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
} else {
|
} else {
|
||||||
req->buf = kzalloc(usbreq->length, GFP_ATOMIC);
|
req->buf = kzalloc(usbreq->length, GFP_ATOMIC);
|
||||||
if (!req->buf)
|
if (!req->buf) {
|
||||||
return -ENOMEM;
|
retval = -ENOMEM;
|
||||||
|
goto probe_end;
|
||||||
|
}
|
||||||
if (ep->in) {
|
if (ep->in) {
|
||||||
memcpy(req->buf, usbreq->buf, usbreq->length);
|
memcpy(req->buf, usbreq->buf, usbreq->length);
|
||||||
req->dma = dma_map_single(&dev->pdev->dev,
|
req->dma = dma_map_single(&dev->pdev->dev,
|
||||||
|
|
Loading…
Reference in New Issue