From patchwork Wed Aug 21 08:42:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2847609 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3181A9F239 for ; Wed, 21 Aug 2013 08:43:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1453E2047D for ; Wed, 21 Aug 2013 08:43:02 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEE3620459 for ; Wed, 21 Aug 2013 08:43:00 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VC40E-0005gI-TF; Wed, 21 Aug 2013 08:42:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VC40C-0003ij-NQ; Wed, 21 Aug 2013 08:42:52 +0000 Received: from aserp1040.oracle.com ([141.146.126.69]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VC409-0003i6-Vt for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2013 08:42:50 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r7L8gOkE000900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Aug 2013 08:42:25 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r7L8gNwk004311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Aug 2013 08:42:24 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r7L8gNDA016446; Wed, 21 Aug 2013 08:42:23 GMT Received: from elgon.mountain (/41.202.233.182) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 21 Aug 2013 01:42:22 -0700 Date: Wed, 21 Aug 2013 11:42:24 +0300 From: Dan Carpenter To: Nicolas Ferre Subject: [patch] usb: gadget: double unlocks on error in atmel_usba_start() Message-ID: <20130821084224.GM5240@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130821_044250_128812_F2DBEFAE X-CRM114-Status: GOOD ( 11.86 ) X-Spam-Score: -7.0 (-------) Cc: devicetree@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org, Rob Herring , Felipe Balbi , Grant Likely , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- I can't compile this. diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 40d2338..2cb52e0 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,