Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp800803img; Fri, 22 Mar 2019 08:51:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyokGMpMwiJ7ruiNK+umRmp0Hm3L6pqhfjbtd+J9cmUvCtEiwbURQ88w8h8TkJxh3Lr9jb3 X-Received: by 2002:a62:204b:: with SMTP id g72mr6471271pfg.51.1553269860991; Fri, 22 Mar 2019 08:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269860; cv=none; d=google.com; s=arc-20160816; b=a6CW4NH4Wq8WFL/61Jzdp0lX69qB+Z9r9geXhg+27J33KC6iROA7jrAcHdDb1HHMvR zFawcCCmBAsYcHFMyE7FD2hNaK3o1pBpuq5Z5bU1srHqY/f6RtZZC6n+t5BV7501FGpb vK98dWAcGl11By9PlXhGBXnx3yvCmE62soTd5e6CQxie5k/r7dO0cYRzbEoyChgUG6nf 92KctRseEPiuH351unQqtIedLrZz5ksVRgzbJLZhFi/mvy2U7Vfof9shoru0QvNI2xLE qc43/7EKdEZRbTfgCtHUMwA4zRZ9dT5u/lkDx+gjhsTH+IZhZxIGfuwLjERDR2lWRv/O +tww== 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=mSn8DW9JzV9w14hOvpN5K//+MIEHaeZapMWVPbsik4la94bCDOKMtc/1Q1Hv9ZQgMu uGMQPY7YSA3JRQYli4aUr7n0denkKPLcXuF7KyajkrdNwsEndofzE7CPzq94Mkg9eju/ jrpkhps0rxIErEbTUqPQj6SDsUoyCTk6Q6+UQZ/W8zpJmX1BKy+kZ4dHWZOYp+UPbUaV BWD55zZF+OywTgz2qkL/dmSVxq5Br0leeJRlQrj6h6YWQZASiSkOOXdsL8nSaQYacX2Y VGh5BFY01MuEwc6j6g0P1kRqF83/QFUQCLSY9KvQRxWKckCKuq6EF9wb3OMmc1LiPPXL hSsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 m2si7003124pfi.269.2019.03.22.08.50.43; Fri, 22 Mar 2019 08:51:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbfCVPuE (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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); -- 2.20.0