From patchwork Mon Nov 5 07:57:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minas Harutyunyan X-Patchwork-Id: 10667543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43FA213B5 for ; Mon, 5 Nov 2018 07:58:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C4A296B6 for ; Mon, 5 Nov 2018 07:58:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27D05296C8; Mon, 5 Nov 2018 07:58:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C2D9296B6 for ; Mon, 5 Nov 2018 07:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726009AbeKERQX (ORCPT ); Mon, 5 Nov 2018 12:16:23 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:51134 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725737AbeKERQW (ORCPT ); Mon, 5 Nov 2018 12:16:22 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0632E24E04BE; Sun, 4 Nov 2018 23:57:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1541404678; bh=Tke855OMSwbrRlUNoqdplN+rL3RGYSu/4XA4oeBcP30=; h=Date:From:Subject:To:CC:From; b=NKO3Odet4WZ/+98FlHN9fAx2nBN/27UbK3imRQNtwpVOJkZQ+FWidXnk6kE1Zcggt +KXXtY3BX3sKPlZLhdZUmEmnO4sztqRDDmoI6SNRL/cia9RF1/pQ8kxHIOXD1JSI0P AWvTOlUSrZ7QV9cceh3RcTGzQcJr7F0OVK50CcXGr4vICHdDqcU6CBxDXK3cBKq5QF SeAPJ0qbSPQaCFzUqectJBzaTEv4npyFE8TebPRusgEacO9ybCx1v2uNDYbRfBtnvE Szl3AcNRYxRCTAZzKhMbcU1UNB0XxPiQwpqhpRDkoKyZmJTXov50YzV/rXO3JQXHZn XztWYI34dKiBQ== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id C67EC328F; Sun, 4 Nov 2018 23:57:57 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 4 Nov 2018 23:57:57 -0800 Received: from hminas-z420 (10.13.184.20) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 4 Nov 2018 23:57:56 -0800 Received: by hminas-z420 (sSMTP sendmail emulation); Mon, 05 Nov 2018 11:57:51 +0400 Date: Mon, 5 Nov 2018 11:57:51 +0400 Message-ID: <6f774b501928599e739143aa3ca0b6a8b4424d79.1541404559.git.hminas@synopsys.com> From: Minas Harutyunyan Subject: [PATCH] usb: dwc2: Fix ep disable spinlock flow. To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , CC: John Youn MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Changed spinlock flow to fix smatch warnings. Fixes: dccf1bad4be7 ("usb: dwc2: Disable all EP's on disconnect") Signed-off-by: Minas Harutyunyan --- drivers/usb/dwc2/gadget.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 2d6d2c8244de..8eb25e3597b0 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4088,9 +4088,7 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); - locked = spin_is_locked(&hsotg->lock); - if (!locked) - spin_lock_irqsave(&hsotg->lock, flags); + locked = spin_trylock_irqsave(&hsotg->lock, flags); ctrl = dwc2_readl(hsotg, epctrl_reg); @@ -4114,7 +4112,7 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) hs_ep->fifo_index = 0; hs_ep->fifo_size = 0; - if (!locked) + if (locked) spin_unlock_irqrestore(&hsotg->lock, flags); return 0;