]> err.no Git - linux-2.6/commitdiff
usb_gadget: composite cdc gadget fault handling
authorDavid Brownell <david-b@pacbell.net>
Tue, 1 Jul 2008 20:18:20 +0000 (13:18 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jul 2008 22:16:48 +0000 (15:16 -0700)
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 <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/cdc2.c
drivers/usb/gadget/u_serial.c

index 289c7527713512296efea0b96dfec90062f29389..d490d0289507290a752b90655323cc2ee7e8871f 100644 (file)
@@ -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;
index 88d4f5452c49baaf42ed6e342139b2977dbc1cea..abf9505d3a75e1a5b263d08b742ad33b108d0fa1 100644 (file)
@@ -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);