aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/cdc-acm.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:05:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:05:37 -0400
commit2849a3a945d0e440fa245c47c49c80ef1cc103c3 (patch)
tree616868130f4b8a063cfa1c138135c10247a4da0e /drivers/usb/class/cdc-acm.c
parent417c765af914106f5e76c4e0181dd555fe6a89a0 (diff)
parent8bb9660418e05bb1845ac1a2428444d78e322cc7 (diff)
Merge 3.9-rc4 into usb-next
This picks up the fixes we had for USB in 3.9-rc4 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r--drivers/usb/class/cdc-acm.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d003c8ca00bc..6d4e0b96f89d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port)
593 593
594 dev_dbg(&acm->control->dev, "%s\n", __func__); 594 dev_dbg(&acm->control->dev, "%s\n", __func__);
595 595
596 tty_unregister_device(acm_tty_driver, acm->minor);
597 acm_release_minor(acm); 596 acm_release_minor(acm);
598 usb_put_intf(acm->control); 597 usb_put_intf(acm->control);
599 kfree(acm->country_codes); 598 kfree(acm->country_codes);
@@ -969,6 +968,8 @@ static int acm_probe(struct usb_interface *intf,
969 int num_rx_buf; 968 int num_rx_buf;
970 int i; 969 int i;
971 int combined_interfaces = 0; 970 int combined_interfaces = 0;
971 struct device *tty_dev;
972 int rv = -ENOMEM;
972 973
973 /* normal quirks */ 974 /* normal quirks */
974 quirks = (unsigned long)id->driver_info; 975 quirks = (unsigned long)id->driver_info;
@@ -1331,11 +1332,24 @@ skip_countries:
1331 usb_set_intfdata(data_interface, acm); 1332 usb_set_intfdata(data_interface, acm);
1332 1333
1333 usb_get_intf(control_interface); 1334 usb_get_intf(control_interface);
1334 tty_port_register_device(&acm->port, acm_tty_driver, minor, 1335 tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor,
1335 &control_interface->dev); 1336 &control_interface->dev);
1337 if (IS_ERR(tty_dev)) {
1338 rv = PTR_ERR(tty_dev);
1339 goto alloc_fail8;
1340 }
1336 1341
1337 return 0; 1342 return 0;
1343alloc_fail8:
1344 if (acm->country_codes) {
1345 device_remove_file(&acm->control->dev,
1346 &dev_attr_wCountryCodes);
1347 device_remove_file(&acm->control->dev,
1348 &dev_attr_iCountryCodeRelDate);
1349 }
1350 device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
1338alloc_fail7: 1351alloc_fail7:
1352 usb_set_intfdata(intf, NULL);
1339 for (i = 0; i < ACM_NW; i++) 1353 for (i = 0; i < ACM_NW; i++)
1340 usb_free_urb(acm->wb[i].urb); 1354 usb_free_urb(acm->wb[i].urb);
1341alloc_fail6: 1355alloc_fail6:
@@ -1351,7 +1365,7 @@ alloc_fail2:
1351 acm_release_minor(acm); 1365 acm_release_minor(acm);
1352 kfree(acm); 1366 kfree(acm);
1353alloc_fail: 1367alloc_fail:
1354 return -ENOMEM; 1368 return rv;
1355} 1369}
1356 1370
1357static void stop_data_traffic(struct acm *acm) 1371static void stop_data_traffic(struct acm *acm)
@@ -1403,6 +1417,8 @@ static void acm_disconnect(struct usb_interface *intf)
1403 1417
1404 stop_data_traffic(acm); 1418 stop_data_traffic(acm);
1405 1419
1420 tty_unregister_device(acm_tty_driver, acm->minor);
1421
1406 usb_free_urb(acm->ctrlurb); 1422 usb_free_urb(acm->ctrlurb);
1407 for (i = 0; i < ACM_NW; i++) 1423 for (i = 0; i < ACM_NW; i++)
1408 usb_free_urb(acm->wb[i].urb); 1424 usb_free_urb(acm->wb[i].urb);