[PATCH 3/3 v2] usb/dwc3: return early in dwc3_cleanup_done_reqs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. We return early in the which should
never happen so the warning vanishes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---

* Felipe Balbi | 2011-11-02 15:10:15 [+0200]:
>but then we will loose the IOC bit check. What do you think ?

It should be okay. The IOC check is only to figure out if the controller
is still processing packets or not. That means if we got the IOC event
then the we can cleanup and the controller is still working. In the other
case (LST set or SHORT OUT) the controller is stopped and waiting for
us.
So in the very unlikely case where the list empty I think we should
behave like we're done and the controller idle. This is undefined anyway
because we should never be here :) Maybe adding a WARN_ON() would be
nice no catch this unlikely event.

 drivers/usb/dwc3/gadget.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 285e45e..1eab7c6 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1308,7 +1308,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
 	do {
 		req = next_request(&dep->req_queued);
 		if (!req)
-			break;
+			return 1;
 
 		dwc3_trb_to_nat(req->trb, &trb);
 
-- 
1.7.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux