Commit 67e7bd24 authored by Javier F. Arias's avatar Javier F. Arias Committed by Greg Kroah-Hartman

staging: emxx_udc: Fix invalid reference error

This patch fixes an invalid reference error by moving the code that
is executed when a queue element is found, into the loop. Also, it
removes an unnecessary test that now checks if the element is not
present in the queue.
Issue found by Coccinelle.
Signed-off-by: default avatarJavier F. Arias <jarias.linux@gmail.com>
Link: https://lore.kernel.org/r/20191030030419.mmnrzm7hr4encfai@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 09ef6fde
...@@ -2660,20 +2660,18 @@ static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) ...@@ -2660,20 +2660,18 @@ static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
/* make sure it's actually queued on this endpoint */ /* make sure it's actually queued on this endpoint */
list_for_each_entry(req, &ep->queue, queue) { list_for_each_entry(req, &ep->queue, queue) {
if (&req->req == _req) if (&req->req == _req) {
break; _nbu2ss_ep_done(ep, req, -ECONNRESET);
} spin_unlock_irqrestore(&udc->lock, flags);
if (&req->req != _req) { return 0;
spin_unlock_irqrestore(&udc->lock, flags); }
pr_debug("%s no queue(EINVAL)\n", __func__);
return -EINVAL;
} }
_nbu2ss_ep_done(ep, req, -ECONNRESET);
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
return 0; pr_debug("%s no queue(EINVAL)\n", __func__);
return -EINVAL;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
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