public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb-serial: fix usb_serial_register bug when boot with nousb param (v2)
@ 2009-02-14 13:21 Dave Young
  0 siblings, 0 replies; only message in thread
From: Dave Young @ 2009-02-14 13:21 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel


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 <hidave.darkstar@gmail.com>
---
drivers/usb/serial/usb-serial.c |    3 +++
1 file changed, 3 insertions(+)

diff -uprN a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	2009-02-14 18:17:16.111250634 +0800
+++ b/drivers/usb/serial/usb-serial.c	2009-02-14 18:19:42.809343462 +0800
@@ -1230,6 +1230,9 @@ int usb_serial_register(struct usb_seria
 	/* must be called with BKL held */
 	int retval;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	fixup_generic(driver);
 
 	if (!driver->description)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-14 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-14 13:21 [PATCH 1/2] usb-serial: fix usb_serial_register bug when boot with nousb param (v2) Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox