usb: dwc3: gadget: return early in dwc3_cleanup_done_reqs()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 3 Nov 2011 09:32:20 +0000 (10:32 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Dec 2011 09:48:32 +0000 (11:48 +0200)
This patch avoids the compiler spitting out the following warning:
|drivers/usb/dwc3/gadget.c:1304: warning: 'trb' is used uninitialized \
in this function

This is only uninitialized if the list of to-cleanup TRBs is empty which
should not be the case because we call this functions once a transfer
completed so it should be on list.

In order to make the warning disappear we return early. This should
never happen and the WARN_ON_ONCE(1) is there in case it happens
so we can investigate what went wrong.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c

index 9497fa5e39213b68f764b9f373a37692678af519..85cf392365cb364056b97145f6d8c4bd5fd2b67a 100644 (file)
@@ -1308,8 +1308,10 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
 
        do {
                req = next_request(&dep->req_queued);
-               if (!req)
-                       break;
+               if (!req) {
+                       WARN_ON_ONCE(1);
+                       return 1;
+               }
 
                dwc3_trb_to_nat(req->trb, &trb);