From patchwork Fri Mar 22 15:44:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160937 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp963991jan; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkd/r2epjsuJguAYd+SXGcSJhRouuwuISNW04/UZ8gITpZv2MXFG/nCl4Xb4TrW4jgSWUu X-Received: by 2002:a63:2f44:: with SMTP id v65mr9470941pgv.141.1553269805069; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269805; cv=none; d=google.com; s=arc-20160816; b=MuOYRjipc9BavrpU2gYSyKl0ttaUV2YvwIk5cvqBKcqNDOEyFLYB3y7mLIdw9ePoel 73dgq0xnI+tWjOgadJPk2QyIu/KZ0florue3wxrNbpJCyBFYydaS8xeylsKgO1vM5/xb Z+4XIpg+VDqZxl8xE5Tt1MnQHzHAAf5SZu11e4uhCY3cga3RYgzWQs1h26VH5I2JMK+X cGeOpwijuJfv7qKHGo438V48IT+1Iy3xGQF1zr34MLYELzcrAm0FX5ujRvdhUvavMv4K s1gryBKY3ewCj5Hgs0c+bzR/4wjdX3GLBvkJNa8C8NncPSQjvmzXAqXqlaptKjLBNiS3 vIaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7HUvG/+LTNj6cdPLIDP9MMQ1DHLLueeDq7hAsHigG/E=; b=G7Hhpe8HqbANBKK8ECtVQ7AXRBXUYhr0+ANW5Xuur9zX+0Xe00slDi/eLSmJARZ9DQ sC//3loeebZxWl/GJXmaPghQHThUETD44B7AlYjrOEsllUIPnMZx6jHzdfJIeITYWAVL wMKIjggzseFX1U/FNhlokUQS+r3OHaoX1Y/B7J2caVlMp+XSjhJti8Wkt2ZcoywaO+Hq LdsFVOG52wyUgjFc7DZqXb4Cl6hrJY4Xjv9gP9nLMoS2r2fg2m+UInHAxmPMIcD0ZMYi jkwsIQXYMQtjdNKls0EiZUspdLddOAf5BF/65pTByHJnMCHrF6s+aILuQ1trj8Ph7c0c OAWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e65si6726403pgc.339.2019.03.22.08.50.04; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbfCVPuE (ORCPT + 14 others); Fri, 22 Mar 2019 11:50:04 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:47715 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPuE (ORCPT ); Fri, 22 Mar 2019 11:50:04 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mhl8Y-1gTv0W3b4S-00djqU; Fri, 22 Mar 2019 16:49:32 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Greg Kroah-Hartman , "Gustavo A. R. Silva" , Kees Cook Cc: Yoshihiro Shimoda , Felipe Balbi , Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 22/25] usb: renesas_usbhs: gadget: fix unused-but-set-variable warning Date: Fri, 22 Mar 2019 16:44:13 +0100 Message-Id: <20190322154425.3852517-23-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:1zbLgMJ6UdcfbbLrnAhs0F7V3us4vKTcxOwFmyGU0N/10ybZgRE ED53FIXpRAfBiH0ccO5Eu4NWKKW1FG1fcV7qbnsKjkz3rEKK8To833eGkRCIDJ8il+83nKz WeOJIqYfc2n8dB+r24eOPo5mRlXJYKm28MkAL7vF2nI8+H0pFsvuirU5DGCXnsxPoFHlAuD 6xYM7LU5e5oap8/2dt7rg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Yla2KSO6I3c=:Kh9bpEPu/6xf11vu+oSgdr n+vvitCcc4b1sUH8dDiQNX70t3EzOwA/0QK0qvzdK6Y+qZbPSq/rLUnFnqgKNrUzXokYEjgmV gPBv+yliIQq8ds2TePkdEl9Pmz5eOOiq8N93FUuEvlQbsRn9Y79Z23krIrervGjHBHyv0Lukb cqQ8zQiE1ojm7ev7Jr4jd8AndKEcBAmsBGrBR35byduKUlVVXoU2/iWCIasUuwuSsIA5Xtx6+ kvb5RbfbPE8WJYwBjbmmNmk7Rrwqr+ynGFVbLX9nwW0hw6N5AkwBahu1FUbJ/M0oZ4pnPn2rM 1EjETdjtSiBMFaguUF8WxAuX1U76TfNfzvIbjT06eqKS2hLBlUxsYP4zuPRTCNUjyt9FjucXO mXwWr/bp5SIhM101OdP3j5fpR2snI0fNGYBK+CY8mteaun0QZ6V+R/1skH5woPFVNR4IgGh9I qQHfPzP8iPdXxy0Li8ympIWfbspwedhNmpo0uM7pshOCQk1yxrLgl3HPmHPSdSuISJxZjWsZ2 Xe5guXDv+k4u4ENNqKMLqrM+LpoB0q9/nTdskdsBY5cvTDDzDs9rejocQirvUl/IV+HMrGW6r 6DMe+zTngq+JVRIv9r19wzJ/LeLt54Vx2W82WpX+soJ28BgDrrxFcs86zGJyZ2Eth7SjGrqBP 0gcJTC5hatKT6F88rL5ECfoKoOGMIy9erdCKFuKRiFB+8o7HXBUZQPvO3mu4Tjobc/28pHp65 JvgamV00R9JFwb3XR3ntwc8cithK/9ZLLFjKsw== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yoshihiro Shimoda The commit b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") causes the unused-but-set-variable warning. But, if the usbhsg_ep_disable() will return non-zero value, udc/core.c doesn't clear the ep->enabled flag. So, this driver should not return non-zero value, if the pipe is zero because this means the pipe is already disabled. Otherwise, the ep->enabled flag is never cleared when the usbhsg_ep_disable() is called by the renesas_usbhs driver first. Fixes: b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") Fixes: 11432050f070 ("usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()") Signed-off-by: Yoshihiro Shimoda Signed-off-by: Felipe Balbi (cherry picked from commit b7d44c36a6f6d956e1539e0dd42f98b26e5a4684) Signed-off-by: Arnd Bergmann --- drivers/usb/renesas_usbhs/mod_gadget.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 8647d2c2a8c4..c5553028e616 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -641,14 +641,11 @@ static int usbhsg_ep_disable(struct usb_ep *ep) struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhs_pipe *pipe; unsigned long flags; - int ret = 0; spin_lock_irqsave(&uep->lock, flags); pipe = usbhsg_uep_to_pipe(uep); - if (!pipe) { - ret = -EINVAL; + if (!pipe) goto out; - } usbhsg_pipe_disable(uep); usbhs_pipe_free(pipe);