Commit 7bbba613 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Greg Kroah-Hartman

usb: renesas_usbhs: gadget: fix unused-but-set-variable warning

[ Upstream commit b7d44c36 ]

The commit b8b9c974 ("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: b8b9c974 ("usb: renesas_usbhs: gadget: disable all eps when the driver stops")
Fixes: 11432050 ("usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()")
Signed-off-by: default avatarYoshihiro Shimoda <>
Signed-off-by: default avatarFelipe Balbi <>
Signed-off-by: default avatarSasha Levin <>
parent 3dd952b4
...@@ -639,14 +639,11 @@ static int usbhsg_ep_disable(struct usb_ep *ep) ...@@ -639,14 +639,11 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
struct usbhs_pipe *pipe; struct usbhs_pipe *pipe;
unsigned long flags; unsigned long flags;
int ret = 0;
spin_lock_irqsave(&uep->lock, flags); spin_lock_irqsave(&uep->lock, flags);
pipe = usbhsg_uep_to_pipe(uep); pipe = usbhsg_uep_to_pipe(uep);
if (!pipe) { if (!pipe)
ret = -EINVAL;
goto out; goto out;
usbhsg_pipe_disable(uep); usbhsg_pipe_disable(uep);
usbhs_pipe_free(pipe); usbhs_pipe_free(pipe);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment