Commit ac90e36592ea5171c4e70f58b39a782d871a7d9f

Authored by David Brownell
Committed by Greg Kroah-Hartman
1 parent c24f42276b

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 <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 2 changed files with 4 additions and 1 deletions Side-by-side Diff

drivers/usb/gadget/cdc2.c
... ... @@ -124,7 +124,7 @@
124 124 return status;
125 125  
126 126 status = acm_bind_config(c, 0);
127   - if (status == 0)
  127 + if (status < 0)
128 128 return status;
129 129  
130 130 return 0;
drivers/usb/gadget/u_serial.c
... ... @@ -1090,6 +1090,9 @@
1090 1090 unsigned i;
1091 1091 struct gs_port *port;
1092 1092  
  1093 + if (!gs_tty_driver)
  1094 + return;
  1095 +
1093 1096 /* start sysfs and /dev/ttyGS* node removal */
1094 1097 for (i = 0; i < n_ports; i++)
1095 1098 tty_unregister_device(gs_tty_driver, i);