On Wed, 3 Mar 2004, David Brownell wrote:

> What you seem to be on to is that when there's a fault before that
> "lock down and go" stage commits, the same cancel-must-giveback
> logic must exist ... it's not just on the success path.  (And that
> patch only handled the success path, which predominates.)
> 
> So maybe some of that logic should exist in hcd_submit_urb(); if
> the (internal) failure were -ENOMSG or somesuch, that could could be
> responsible for the giveback().  I'd support such a patch; better
> than having that particular logic in all the HCDs.

> > shouldn't, because you can't succeed in unlinking an URB that wasn't 
> > linked to begin with.  (Of course, it really was linked for a brief period 
> 
> Exactly:  it was linked, and that fact was advertised to the rest
> of the kernel.  All parts of this story need to agree!

You're saying that this code at the end of hcd_submit_urb() is wrong:

        status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
done:
        if (status) {
                usb_put_urb (urb);
                urb_unlink (urb);
        }
        return status;
}

Ignore for the moment code paths that reach the done: label via a jump.  
Regardless of the status returned by enqueue(), the URB has already been
linked.  So hcd_submit_urb() must return 0, not status.  If enqueue() does
return non-zero (any value, not just -ENOMSG) then the URB has to be sent
to giveback; calling urb_unlink() is not enough.

Alan Stern



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to