On Thu, 25 Jan 2007, Oleg Verych wrote:

> On Thu, Jan 25, 2007 at 03:53:58PM +0100, Oliver Neukum wrote:
> [] 
> > Yes, there is something wrong with the design of this device.
> > For these cases there's
> > int usb_driver_set_configuration(struct usb_device *udev, int config)
> > 
> > You check the current configuration probe() is called with, call
> > this helper function and exit with an error from probe.
> 
> It is relatively new. As comment states, it doesn't guarantee
> anything, caller hangs in air...

Actually that routine has only two significant failure modes:

    1.  Unable to allocate a small block of memory.  If memory is that
        tight, you probably don't want your driver running at all.

    2.  The Set-Config request itself fails.  If that happens you're
        completely stuck -- even if a userspace program had requested
        the change it wouldn't work.

So on the whole usb_driver_set_configuration() should be very reliable.  
And the only times it can fail are when it wouldn't do any good anyway.

As for being relatively new...  That's true, and it's a fault all code
suffers from at one time or another.  There's not much we can do about it
except wait until the routine gets older.  :-)

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to