diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-08-21 04:42:24 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-08-27 16:05:35 -0400 |
commit | ffb62a14c7b6109ca4ee9bb360ad867b294acddc (patch) | |
tree | 65791d4ba025823edf495b431b6abbcd6569a9d2 /drivers/usb | |
parent | 0f82768406914d1391ec6d087500db7405f8f68e (diff) |
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')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 10 |
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: | |||
1772 | static int atmel_usba_start(struct usb_gadget *gadget, | 1772 | static int atmel_usba_start(struct usb_gadget *gadget, |
1773 | struct usb_gadget_driver *driver) | 1773 | struct usb_gadget_driver *driver) |
1774 | { | 1774 | { |
1775 | int ret = 0; | 1775 | int ret; |
1776 | struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); | 1776 | struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); |
1777 | unsigned long flags; | 1777 | unsigned long flags; |
1778 | 1778 | ||
@@ -1784,11 +1784,11 @@ static int atmel_usba_start(struct usb_gadget *gadget, | |||
1784 | 1784 | ||
1785 | ret = clk_prepare_enable(udc->pclk); | 1785 | ret = clk_prepare_enable(udc->pclk); |
1786 | if (ret) | 1786 | if (ret) |
1787 | goto out; | 1787 | return ret; |
1788 | ret = clk_prepare_enable(udc->hclk); | 1788 | ret = clk_prepare_enable(udc->hclk); |
1789 | if (ret) { | 1789 | if (ret) { |
1790 | clk_disable_unprepare(udc->pclk); | 1790 | clk_disable_unprepare(udc->pclk); |
1791 | goto out; | 1791 | return ret; |
1792 | } | 1792 | } |
1793 | 1793 | ||
1794 | DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); | 1794 | DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); |
@@ -1804,11 +1804,9 @@ static int atmel_usba_start(struct usb_gadget *gadget, | |||
1804 | usba_writel(udc, CTRL, USBA_ENABLE_MASK); | 1804 | usba_writel(udc, CTRL, USBA_ENABLE_MASK); |
1805 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); | 1805 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); |
1806 | } | 1806 | } |
1807 | |||
1808 | out: | ||
1809 | spin_unlock_irqrestore(&udc->lock, flags); | 1807 | spin_unlock_irqrestore(&udc->lock, flags); |
1810 | 1808 | ||
1811 | return ret; | 1809 | return 0; |
1812 | } | 1810 | } |
1813 | 1811 | ||
1814 | static int atmel_usba_stop(struct usb_gadget *gadget, | 1812 | static int atmel_usba_stop(struct usb_gadget *gadget, |