summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/atmel_usba_udc.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-08-21 11:42:24 +0300
committerFelipe Balbi <balbi@ti.com>2013-08-27 15:05:35 -0500
commitffb62a14c7b6109ca4ee9bb360ad867b294acddc (patch)
tree65791d4ba025823edf495b431b6abbcd6569a9d2 /drivers/usb/gadget/atmel_usba_udc.c
parent0f82768406914d1391ec6d087500db7405f8f68e (diff)
downloadlwn-ffb62a14c7b6109ca4ee9bb360ad867b294acddc.tar.gz
lwn-ffb62a14c7b6109ca4ee9bb360ad867b294acddc.zip
usb: gadget: double unlocks on error in atmel_usba_start()
The "goto out" statements were wrong. We aren't holding any locks at that point so we should return directly. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 40d23384b716..2cb52e0438df 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1772,7 +1772,7 @@ out:
static int atmel_usba_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
- int ret = 0;
+ int ret;
struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget);
unsigned long flags;
@@ -1784,11 +1784,11 @@ static int atmel_usba_start(struct usb_gadget *gadget,
ret = clk_prepare_enable(udc->pclk);
if (ret)
- goto out;
+ return ret;
ret = clk_prepare_enable(udc->hclk);
if (ret) {
clk_disable_unprepare(udc->pclk);
- goto out;
+ return ret;
}
DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
@@ -1804,11 +1804,9 @@ static int atmel_usba_start(struct usb_gadget *gadget,
usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
}
-
-out:
spin_unlock_irqrestore(&udc->lock, flags);
- return ret;
+ return 0;
}
static int atmel_usba_stop(struct usb_gadget *gadget,