Re: [PATCH 3/3] usb/dwc3: initialize the trb in cleanup

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

 



Hi,

On Wed, Nov 02, 2011 at 02:42:24PM +0200, Felipe Balbi wrote:
> On Wed, Nov 02, 2011 at 01:30:46PM +0100, Sebastian Andrzej Siewior wrote:
> > This patch avoids the compiler spitting out the following warning:
> > |drivers/usb/dwc3/gadget.c:1304: warning: ‘trb’ is used uninitialized in this function
> 
> funny, I don't see this warning either with arm or x86 gcc. Which
> compiler are you using ?
> 
> I have:
> 
> $ gcc --version
> gcc (Debian 4.6.1-15) 4.6.1
> 
> $ arm-linux-gcc --version
> arm-linux-gcc (Sourcery G++ Lite 2010.09-50) 4.5.1

Now I saw why your compiler is giving that warning. If our req_queued is
empty, we will break out of the while loop but before returning we check
that event->status IOC bit is the same as TRB's IOC bit.

I'm thinking about changing your patch like so:

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bec7907..a460fd8 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1334,7 +1334,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 0;
 
 		dwc3_trb_to_nat(req->trb, &trb);
 

but then we will loose the IOC bit check. What do you think ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux