Duncan Sands wrote:
disconnect called

(still have the reference)

If you still hold it after your disconnect() returned, the bug is in your driver ...


...time passes...

final driver shutdown: I drop the reference using usb_dec_dev_use, which
oopses.


Hi Dave, why is it a bug? I hold a reference to the device, so it should be valid to call routines using it. Sure, those routines can return failure - but they should not oops. I am talking philisophy, not reality, of course.

The philosophy is often called "programming by contract".


And the contract is:  usbcore agrees to work with your driver
and do everything right, if your driver agrees to do a few
specific things.  One of those specific things is never using
the device after you return from disconnect(), either directly
(as you're doing here) or indirectly (urb still pending, say).

If you break such programming contracts, bad things happen;
that's part of why the contract exists.  There are lots of
components interacting, relying on contracts to be followed,
and if they aren't ... it's impractical to guarantee that
all the failure modes will always be benign.

- Dave




------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to