Skip to content

Commit

Permalink
usb: renesas_usbhs: gadget: fix unused-but-set-variable warning
Browse files Browse the repository at this point in the history
commit b7d44c3 upstream.

The commit b8b9c97 ("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: b8b9c97 ("usb: renesas_usbhs: gadget: disable all eps when the driver stops")
Fixes: 1143205 ("usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()")
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
shimoday authored and gregkh committed Apr 3, 2019
1 parent e86206b commit 4104b44
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/usb/renesas_usbhs/mod_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4104b44

Please sign in to comment.