From: David Brownell Date: Tue, 1 Jul 2008 20:18:20 +0000 (-0700) Subject: usb_gadget: composite cdc gadget fault handling X-Git-Tag: v2.6.27-rc1~946^2~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=ac90e36592ea5171c4e70f58b39a782d871a7d9f;p=linux-2.6-omap-h63xx.git usb_gadget: composite cdc gadget fault handling These two fixes ensure the new "CDC Composite Device" gadget fails cleanly when it's loaded on hardware that can't support this particular gadget driver. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 289c7527713..d490d028950 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -124,7 +124,7 @@ static int __init cdc_do_config(struct usb_configuration *c) return status; status = acm_bind_config(c, 0); - if (status == 0) + if (status < 0) return status; return 0; diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 88d4f5452c4..abf9505d3a7 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c @@ -1090,6 +1090,9 @@ void gserial_cleanup(void) unsigned i; struct gs_port *port; + if (!gs_tty_driver) + return; + /* start sysfs and /dev/ttyGS* node removal */ for (i = 0; i < n_ports; i++) tty_unregister_device(gs_tty_driver, i);