From: Dave Young Date: Sat, 14 Feb 2009 13:21:13 +0000 (+0800) Subject: usb-serial: fix usb_serial_register bug when boot with nousb param X-Git-Tag: v2.6.30-rc1~670^2~50 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=e4abe6658aa17a5d7e7321dfda807d287255511b;p=linux.git usb-serial: fix usb_serial_register bug when boot with nousb param With "nousb" cmdline booting, built-in serial drivers (ie. airecable) will trigger kernel oops. Indeed, if nousb, usb_serial_init will failed, and the usb serial bus type will not be registerd, then usb_serial_register call driver_register which try to register the driver to a not registered bus. Here add usb_disabled() check in usb_serial_register to fix it. Signed-off-by: Dave Young Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 73172898ccb3..742a5bc44be8 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -1241,6 +1241,9 @@ int usb_serial_register(struct usb_serial_driver *driver) /* must be called with BKL held */ int retval; + if (usb_disabled()) + return -ENODEV; + fixup_generic(driver); if (!driver->description)