From patchwork Wed Apr 26 11:50:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 9701269 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF849603F4 for ; Wed, 26 Apr 2017 11:52:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD85F28468 for ; Wed, 26 Apr 2017 11:52:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1BEC284EA; Wed, 26 Apr 2017 11:52:47 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 59C1628468 for ; Wed, 26 Apr 2017 11:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943898AbdDZLwq (ORCPT ); Wed, 26 Apr 2017 07:52:46 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:39488 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1949599AbdDZLwg (ORCPT ); Wed, 26 Apr 2017 07:52:36 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 26 Apr 2017 20:52:33 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id AEE4271647; Wed, 26 Apr 2017 20:52:33 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.37,254,1488812400"; d="scan'208";a="240959732" Received: from mail-hk2apc01lp0210.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.210]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 26 Apr 2017 20:52:33 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+/avueSwKQk37bKgKJVa3CX5iu1Vyx6MgiIQSaJ1bfU=; b=AyJ1scpLQLJ79DgvCDykL1KxIkdcyx/Poh97ZM5qnS/sJ6HBkvp+Bos+yZ5HshrGrJmdgPL+IG93CjN+hxBMD97swAwzX9GhUsjHY1UqBM1BnEfPTAXbXuV8Y2ovcrRHIofS078Yr4AdccxwJQXH6VJ9hdOMn9WlsGj5NEDHQOc= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=renesas.com; Received: from localhost.localdomain (211.11.155.144) by HK2PR06MB1683.apcprd06.prod.outlook.com (10.167.73.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Wed, 26 Apr 2017 11:52:32 +0000 From: Yoshihiro Shimoda To: CC: , , , Yoshihiro Shimoda Subject: [PATCH 2/5] usb: gadget: udc: renesas_usb3: fix deadlock by spinlock Date: Wed, 26 Apr 2017 20:50:08 +0900 Message-ID: <1493207411-24416-3-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493207411-24416-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1493207411-24416-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0039.jpnprd01.prod.outlook.com (10.164.161.149) To HK2PR06MB1683.apcprd06.prod.outlook.com (10.167.73.9) X-MS-Office365-Filtering-Correlation-Id: 2de9adec-84c7-4ebe-db6f-08d48c9ab926 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:HK2PR06MB1683; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1683; 3:wng3r0vkdP06rSGL3YnRtg/hLb6hDFeEtkO3t8SUB9tY4ctqXbCq518P8/K9tb0db3cpfQEa29/j3U00izOYjmY3oaYfbw1COv0jQuJaWTYSHUCnhN2M6hh1mQGhu2+sXnhS7kN/mb7GLTpcw9zWixPp0BabJf2qNV39kxabmzc38cTRseR2v2CllWRW3ZjhC3m3QGTQ2aX1PPCho8kG+2QXBVvbeFExkWEST6Yf6axlh5Xptu4vCvVg9YyGYXhWGyuaViZhjxTECqcMYWKsOc5BxbNSoc1kSu5P+ZWDynewuxUaejR2Gn50JN/N3Xqe9EbsvuMTGtBqgrX5xZrUsjmN4Gf+WrZ4BHjcBX1mmX0=; 25:W+iKc/fPW0quYU1kovAZrSOmTVoViWV1GAZtV19jTMBEpmvUcFfZNsVugqfMzEwfEbHUEcHybD2OKWz0Dv7CDO+azf3OJQ39nRPj2zVLWQcR+APttOnTuD2yb1bKLeyEkhT5FLAsly9p/XSdA/Ns5Roo6nGSztgk5+3IwYxECXPMZTuq5at0bsNh18nFZik8GsyayjSO0/y3zgp4dYXsAZmlXsw/OQDx2TAbXw08W6/i2UFmL8/nS0Gnax1iqIsv5RsgZSqGWJd28ZPNTTL4TfKGhZvLhwvd/3FdPZ9HrNPD//rCmSDEfRKHZxlN6QfkecE3g4ukxZjOAUtoYPSYY5xHL+WgGluuemDx28iHx1al1CdS5MhitQl2m1+TCPqwc03oeO02WWJ2oH099mUSd2SPJ4aJl+Q9f6vYZZkWYxUEyBtmPz6sCLObktAe47VfhqqgeNkf4NwxVOaGx2GfUg== X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1683; 31:GN6Px5pWMoRPZ/Hn+XCJXOEH7G3XzeetP40FudvgZXbCmEGB7TYZFbD+BrQWu7hR7ttqF5mu3kmNsIQwvRGsAoS6e/zN78rnk8JQOgu2zjw/uR7+jK3EOpM7wYculIsHIpHsY7xsxQpSuUDs09Yj8KpJHLTTGdVZAg6nRnBUWhD6nXFVRytdiBuHQWkEkdgO6pWrVtpaSbMZU4D/o1daMNUC26cBbE8vvB/74ttofyo=; 20:zp+YRORZos5eRPeL59/CaSfiDlMLy1FbDHMp80E1ejXG2dYc+5nrvo3hka8ETzAdSpuB1YfySaUiPl8PCLVk1oE+IuRzbd9sZb5KbHVVYxVU4QXMDY6UJ7y/oxC13mddxRXxfKd1ju0osV5vAry/mlWjJDf3MdjQ3iwWngQc7qXX++6pSNBFL8WJSx+DLcpYmGoELNV9tuqEwL5+AXfNxJ29NAUZPtE+9kj7LWJbTKDDi33SgMPShQlBr7wJdEOx+84pQi/bx6f6rB5Q/odWGUCziPGC97r5jjqyUOVHixivA/KU835sImRbcptkW9gDTcNNVOAJdUPSvUpi2qEjFxuATKEhyLcEl8UWEm1eGZVfpMO/8m9EVmPep9Mrg9+7c9wji3qQCUebQXaJvFNDf+sPemF8cJOpDX99ZAD88rQ3FE3MUqqEia6aPCBxG6EmlHIfqEd21rwdjDQkdXaBlTcmisTdoKHq4ph7/oDnJxiEtxd/s20FBqd7MBjTJbHV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(6072148); SRVR:HK2PR06MB1683; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB1683; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1683; 4:Et5Lkggkkbv+dt8I6BICGhKW9BF27HuUln77qeAWNHf8hLO+/JKhUQxVG0yKowfBVB/zbP82qhbfqaA2jPaCSBd/wfFDsP7S63zZxPaCXTOymtQGlxNDNTwmGQBu91BhxJYGP2Al1LrkfJQTrt21Kr4AJwKyiCi0vybQ8FiPo7mjH1q4oWDUlj5Q2YvocvH7s0wty43yu/6Ob+e0Y7+cNdwkBN+KrXKI6uRQnIx2I3Poyoht2TVBEWy9Nj9AwOKN5RzpZI5Ro2pCMTktCi/u+kAjc4uO4C89fl3x7yvrb13UkEBWCgVPTX4zDah7ICj1CW+sdIWkeal/KtyIoiPhdXoSgomamvD2Glfo0rISqItsZfZbErJAOegDNDvfyqW8vyIEUvSA4vHaVqC4+7Gt/U693/znF3mjSoEo4gQVc0gFFWIayXOt6IGeJnmOlrISn94637D7G5IWZBog/vMJ22bB9KGw1D/JDrLlkQ3/eryWDjPmKJCOkO1NX2FT5c5AldGIhX1oY0GsZikOSHgSv6O/oahZ40dvxJKDEMKV5U9ASB59jVEzXtkWta1AgQHsducexQmJO6Lvf6d3xg8nOpA+slnzSHbJiEm/A+CRqBr6NkdKmlW/Uuih+R26cTT/sNmDHxrLaNZdNcHl2hD3Lw40eZsIedvRMKJcot52grgQ/SUokWJH9iPNpfh5lPp1gdasm/7KFoBEJuIeeJ6Vac01YFzDlCPLgvIhW1e5LfhxH5gB281YGk/6ROzDEJO26FCXU3WyJhkdcI9mIKx78q0yfZN/3MoJaq8B1TZbI5I= X-Forefront-PRVS: 0289B6431E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(39850400002)(39450400003)(39860400002)(39410400002)(39400400002)(39840400002)(54906002)(6512007)(53936002)(189998001)(42186005)(2351001)(2906002)(38730400002)(50986999)(76176999)(33646002)(66066001)(6506006)(6486002)(6666003)(107886003)(2950100002)(6916009)(42882006)(110136004)(4326008)(47776003)(25786009)(36756003)(78352004)(5003940100001)(5660300001)(305945005)(7736002)(3846002)(6116002)(50466002)(8676002)(81166006)(50226002)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB1683; H:localhost.localdomain; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB1683; 23:JUtBC6sPBFg1St59/v79X4PgnnUFexmSbg5f4LyWy?= =?us-ascii?Q?kiQQpbHlgPNeWMv8CWBmq7lSWvp6+PznjFgIiKkM6qktqQXzpMJ2c+zZFvQL?= =?us-ascii?Q?1urYCSkb1YUgm0MPjP6sRsn37YsCqiNputvH0euxxbvxeG9/00mr0nIEYAVZ?= =?us-ascii?Q?aeW4Nf491EJTGlwBaDkd+HebvzgoPKetk39zkfMYNYZu9goqX3q2lc18ANJM?= =?us-ascii?Q?0Mz94z5XEfO3IF8vEikob+YIcz1UgxzXgKdw+fEjhDM3o2ab6jzvTV8rkkfb?= =?us-ascii?Q?uIaacvdni6c+dnpjp1X8CPHiQyFSSa5a6MNY429rlhHnlNIpXzGPLFEmeOuo?= =?us-ascii?Q?Za81N/dPnM/r3Qp7oBRzBf+nIe5YnrKxKG2AfUWJcKJ7yQAa8JXfHFgil0Zo?= =?us-ascii?Q?w8ycewjhj5yZBpN7JfyFBpmf5EI9ya3kAupFxNzD/k7MwSHlc+JN/GE3WpmN?= =?us-ascii?Q?e7kHYX0LAvaK0SCAJm21ULHY2QpP3be82pVBxFkin1DBEZUl8XaffpIep8f/?= =?us-ascii?Q?Y48gneodDvlxr1GoeWn+go4DW7jGe2T4sAmgANLts30y/hgsVuF4yOLtG21y?= =?us-ascii?Q?fzKLWP7d9hjc1FRbCq0kOnXFXPgA9CaAbfAZH5+I9dklGMC7zpjpYz1gzmxJ?= =?us-ascii?Q?Cwh4R9RNrO6xS5hXOWucztDIYYmfAveaOv3R7jWeH5DAkKBmNXRD4EakhGQc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HiZvwnDKn1kZSBDjwC7rXUiCN78Z7EvPX7hDtYhVUjJ8w6IsQjNV9+dU+y6GepHqGU1Nlou0t3qcr5Kk6OpdifSCrTwAAMNzlJZzAZTOLPE2ZjaiEHJCw1WLkk8lLaQ==; 5:n6+CeK5z0nFZK1Jnr9ZT2S9pymr4OkJeFy9EEqkKOlxCvTO3M0MPvROS5ORNEwmyvKQNq+hN7kFmra0fbpJwUigINzANyTIgr7FHg6ogRlgA6kLpQ37fYms45YTLwxTnrx9KnSePNDt3JRG6h/cEkA==; 24:gt1UbTbEk7/Dz0vZ3uyNZlB4SXVgJL/1wEOFqvfY4WLW5nkEcUX1hldpWKmqqxJQqnOXJI8soPphjHgNTM2ABwINtA0sGl/y/M7UJTFougQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1683; 7:8uvp9G+2BSlCJv8cE5eQINqdL6rSztt1BsZFlF141n8uoM8kbVRBQJpZJINRj7FPyfGgOOPr+oCiTL+fQAtal5z2EYPMg6QDvQPVlZOKkmsOd3NG0+fu+6jhPzo7au+AJtsP/vnAkMb3tRzuz4kmOjjyjtrHud5qG8a6E9B1Ao5v0DxHRE25zyazdE7lE8tiLWQ6VlDahmngNSE8579zdf8H6H9p/bGLBXP+A2mb2Big2xxmN+Tx52zjnZWAswW3W2XQf6QQD1HQyMoob1Xd3uPoyVM5d1oqqqDX2kpSQstZsajkCUTfXmcNvhkN++CBcMup49c8Kgux0PbE692Kww==; 20:h5Vr0W12uQUxzSdXobClVKVGa3Zvu0jxoG5VKMy0tKrQzBxSPSHzQRVodJPL10S98filbyNmcNoxHKG4NWUgzB+5GuVKuzLUUJYqlg7ZSlb+XXvn28qRPH7LST4bULzdW7bTscqvlE+W/KHkcFketJJq+LWTJyBq9BWPkcE/f/M= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 11:52:32.0109 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1683 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes an issue that this driver is possible to cause deadlock by double-spinclocked in renesas_usb3_stop_controller(). So, this patch removes spinlock API calling in renesas_usb3_stop(). (In other words, the previous code had a redundant lock.) Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller") Signed-off-by: Yoshihiro Shimoda --- drivers/usb/gadget/udc/renesas_usb3.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 10585da..e27d948 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -1810,14 +1810,11 @@ static int renesas_usb3_start(struct usb_gadget *gadget, static int renesas_usb3_stop(struct usb_gadget *gadget) { struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget); - unsigned long flags; - spin_lock_irqsave(&usb3->lock, flags); usb3->softconnect = false; usb3->gadget.speed = USB_SPEED_UNKNOWN; usb3->driver = NULL; renesas_usb3_stop_controller(usb3); - spin_unlock_irqrestore(&usb3->lock, flags); pm_runtime_put(usb3_to_dev(usb3)); pm_runtime_disable(usb3_to_dev(usb3));