usb: dwc3: avoid -Wmaybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 9 Sep 2016 10:01:51 +0000 (12:01 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 9 Sep 2016 11:56:06 +0000 (14:56 +0300)
commitd6e10bf2ba4783881670731faf8d3705cad488eb
tree0ab281fbb3cf757e448b4a77090f064ee68ec804
parentc9ffc78745f89e300fe704348dd8e6800acf4d18
usb: dwc3: avoid -Wmaybe-uninitialized warning

Cleaning up the loop in dwc3_cleanup_done_reqs() introduced a
gcc warning if built with "-Wmaybe-uninitialized":

drivers/usb/dwc3/gadget.c: In function 'dwc3_endpoint_transfer_complete':
drivers/usb/dwc3/gadget.c:2015:9: 'trb' may be used uninitialized in this function [-Wmaybe-uninitialized]

I believe it is a false positive and we always have a valid 'trb'
pointer at the end of the function, but neither I nor the compiler
are able to prove that.

This works around the warning by computing a flag earlier in the function
when it's guaranteed to be valid, which tells the compiler that it's
safe and makes it easier to understand to me.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 31162af447d7 ("usb: dwc3: gadget: avoid while (1) loop on completion")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/gadget.c