Oliver Neukum <oneukum@xxxxxxxx> writes: > The r8152 interface driver is preferred over the generic > class driver because it provides more features. Hence > we now have a device driver that switches the configuration. > > That device driver is sensible only if an interface driver > for the selected configuration exists. > However, the initialization for this module first reisters > the device driver and after that the interface driver. > That screws up error handling. Both registrations return > error codes. That means that the registration of the > device driver can currently work, but the interface > driver can fail. > In that case we switch the devices to a configuration > we have no driver for. That must not happen. The easiest > fix is to register the interface driver first and > bail out if that fails. That way if the device driver > fails, nothing needs to be undone. Yup. Switching this around makes sense. > + ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE); > + return ret; > + Why not return usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE); ? Bjørn