From patchwork Fri Oct 17 19:16:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38995 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E234202DB for ; Fri, 17 Oct 2014 19:16:55 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf825743lab.2 for ; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=ajUqK1raVhouQOU5rgHeKlmKQbMqT6DtGY7DawKmGHs=; b=Z5rs+NJVd+2ZK+ppXiqAx9ijtN+Xzz1t/97530vl2fiydp+B+Fju4OuhXHoMPZeZOG px0lORnOm7u8YfileOmmfhmeHXdybmalsD5oOm71G37VWKatMJpCxx5ICUsqIDUCcBsJ ZEyW27vHbMfMJdGSXzgNB4wLKdi+P8/pEe4CimDy8HLDKGL9HQQhRv4m4OSeKNrFqvLw cQnLTx0kb3ep9RvKhWc2UcsmftWl6ZHeHrL5u7CuHTZ1bNzyTL3N5s7R6ZuHxxIUQks1 ONqzn8405LLGM0k1llu2SKGzaL7/ikJhNy/O2WQwsGgVWyjlCiinLfoChLI/0xfU4dVZ RUkw== X-Gm-Message-State: ALoCoQmd4b3mcDlDw0vkXzNdOG0cyanFwI99rpoMvJsvKWu+UfBIGT/VZdmeu/yZ0MHA8NoWsyMP X-Received: by 10.181.27.135 with SMTP id jg7mr142619wid.5.1413573413725; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.202 with SMTP id y10ls296519lad.51.gmail; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) X-Received: by 10.152.21.226 with SMTP id y2mr10964418lae.70.1413573413468; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id k1si3455541lah.55.2014.10.17.12.16.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 12:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id z11so1171503lbi.41 for ; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr6261048lap.44.1413573413348; Fri, 17 Oct 2014 12:16:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp288114lbz; Fri, 17 Oct 2014 12:16:52 -0700 (PDT) X-Received: by 10.66.185.49 with SMTP id ez17mr10334163pac.25.1413573411714; Fri, 17 Oct 2014 12:16:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id su2si1899767pbc.70.2014.10.17.12.16.51 for ; Fri, 17 Oct 2014 12:16:51 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753313AbaJQTQu (ORCPT + 1 other); Fri, 17 Oct 2014 15:16:50 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:60494 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753298AbaJQTQu (ORCPT ); Fri, 17 Oct 2014 15:16:50 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HJGjAs022283; Fri, 17 Oct 2014 14:16:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HJGjwU022201; Fri, 17 Oct 2014 14:16:45 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 14:16:45 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HJGiI5012898; Fri, 17 Oct 2014 14:16:45 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Sudip Mukherjee , , Sudip Mukherjee , Felipe Balbi Subject: [PATCH] usb: dwc2: gadget: sparse warning of context imbalance Date: Fri, 17 Oct 2014 14:16:35 -0500 Message-ID: <1413573395-21755-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Sudip Mukherjee sparse was giving the following warning: warning: context imbalance in 's3c_hsotg_ep_enable' - different lock contexts for basic block we were returning ENOMEM while still holding the spinlock. The sparse warning was fixed by releasing the spinlock before return. Cc: # v3.17 Acked-by: Paul Zimmerman Signed-off-by: Sudip Mukherjee Signed-off-by: Felipe Balbi --- Resending so it reaches stable@vger.kernel.org Once v3.18-rc1 is tagged, I'll move this to my 'fixes' branch. drivers/usb/dwc2/gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7b5856f..7f25527 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2561,8 +2561,10 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, hs_ep->fifo_size = val; break; } - if (i == 8) - return -ENOMEM; + if (i == 8) { + ret = -ENOMEM; + goto error; + } } /* for non control endpoints, set PID to D0 */ @@ -2579,6 +2581,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, /* enable the endpoint interrupt */ s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); +error: spin_unlock_irqrestore(&hsotg->lock, flags); return ret; }