aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/emxx_udc/emxx_udc.c
diff options
context:
space:
mode:
authorJavier F. Arias <jarias.linux@gmail.com>2019-10-29 22:04:19 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-30 10:38:46 +0100
commit67e7bd248473ede722563ae1a8d24e856a42f644 (patch)
treedbbd3cbd1a42e349a317146f47e38808e183c8ee /drivers/staging/emxx_udc/emxx_udc.c
parentstaging: kpc2000: kpc_i2c: Remove commented code (diff)
downloadlinux-dev-67e7bd248473ede722563ae1a8d24e856a42f644.tar.xz
linux-dev-67e7bd248473ede722563ae1a8d24e856a42f644.zip
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: Javier F. Arias <jarias.linux@gmail.com> Link: https://lore.kernel.org/r/20191030030419.mmnrzm7hr4encfai@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--drivers/staging/emxx_udc/emxx_udc.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index e899130aedce..03929b9d3a8b 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -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 */
list_for_each_entry(req, &ep->queue, queue) {
- if (&req->req == _req)
- break;
- }
- if (&req->req != _req) {
- spin_unlock_irqrestore(&udc->lock, flags);
- pr_debug("%s no queue(EINVAL)\n", __func__);
- return -EINVAL;
+ if (&req->req == _req) {
+ _nbu2ss_ep_done(ep, req, -ECONNRESET);
+ spin_unlock_irqrestore(&udc->lock, flags);
+ return 0;
+ }
}
- _nbu2ss_ep_done(ep, req, -ECONNRESET);
-
spin_unlock_irqrestore(&udc->lock, flags);
- return 0;
+ pr_debug("%s no queue(EINVAL)\n", __func__);
+
+ return -EINVAL;
}
/*-------------------------------------------------------------------------*/