diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-01 15:01:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-01 15:01:10 -0400 |
commit | ef99f3aee9641d10a7c80d4803d2f0f004c797ca (patch) | |
tree | 83f14ccef66db48fc4178bd8b973462006de86b8 /drivers/usb/class/cdc-acm.c | |
parent | cb06ff102e2d79a82cf780aa5e6947b2e0529ac0 (diff) | |
parent | 07961ac7c0ee8b546658717034fe692fd12eefa9 (diff) |
Merge 3.9-rc5 into tty-next
We need the fixes here as well.
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.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 27a18743275e..c77f7ae48f1c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -582,7 +582,6 @@ static void acm_port_destruct(struct tty_port *port) | |||
582 | 582 | ||
583 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 583 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
584 | 584 | ||
585 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
586 | acm_release_minor(acm); | 585 | acm_release_minor(acm); |
587 | usb_put_intf(acm->control); | 586 | usb_put_intf(acm->control); |
588 | kfree(acm->country_codes); | 587 | kfree(acm->country_codes); |
@@ -966,6 +965,8 @@ static int acm_probe(struct usb_interface *intf, | |||
966 | int num_rx_buf; | 965 | int num_rx_buf; |
967 | int i; | 966 | int i; |
968 | int combined_interfaces = 0; | 967 | int combined_interfaces = 0; |
968 | struct device *tty_dev; | ||
969 | int rv = -ENOMEM; | ||
969 | 970 | ||
970 | /* normal quirks */ | 971 | /* normal quirks */ |
971 | quirks = (unsigned long)id->driver_info; | 972 | quirks = (unsigned long)id->driver_info; |
@@ -1328,11 +1329,24 @@ skip_countries: | |||
1328 | usb_set_intfdata(data_interface, acm); | 1329 | usb_set_intfdata(data_interface, acm); |
1329 | 1330 | ||
1330 | usb_get_intf(control_interface); | 1331 | usb_get_intf(control_interface); |
1331 | tty_port_register_device(&acm->port, acm_tty_driver, minor, | 1332 | tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, |
1332 | &control_interface->dev); | 1333 | &control_interface->dev); |
1334 | if (IS_ERR(tty_dev)) { | ||
1335 | rv = PTR_ERR(tty_dev); | ||
1336 | goto alloc_fail8; | ||
1337 | } | ||
1333 | 1338 | ||
1334 | return 0; | 1339 | return 0; |
1340 | alloc_fail8: | ||
1341 | if (acm->country_codes) { | ||
1342 | device_remove_file(&acm->control->dev, | ||
1343 | &dev_attr_wCountryCodes); | ||
1344 | device_remove_file(&acm->control->dev, | ||
1345 | &dev_attr_iCountryCodeRelDate); | ||
1346 | } | ||
1347 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | ||
1335 | alloc_fail7: | 1348 | alloc_fail7: |
1349 | usb_set_intfdata(intf, NULL); | ||
1336 | for (i = 0; i < ACM_NW; i++) | 1350 | for (i = 0; i < ACM_NW; i++) |
1337 | usb_free_urb(acm->wb[i].urb); | 1351 | usb_free_urb(acm->wb[i].urb); |
1338 | alloc_fail6: | 1352 | alloc_fail6: |
@@ -1348,7 +1362,7 @@ alloc_fail2: | |||
1348 | acm_release_minor(acm); | 1362 | acm_release_minor(acm); |
1349 | kfree(acm); | 1363 | kfree(acm); |
1350 | alloc_fail: | 1364 | alloc_fail: |
1351 | return -ENOMEM; | 1365 | return rv; |
1352 | } | 1366 | } |
1353 | 1367 | ||
1354 | static void stop_data_traffic(struct acm *acm) | 1368 | static void stop_data_traffic(struct acm *acm) |
@@ -1400,6 +1414,8 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1400 | 1414 | ||
1401 | stop_data_traffic(acm); | 1415 | stop_data_traffic(acm); |
1402 | 1416 | ||
1417 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
1418 | |||
1403 | usb_free_urb(acm->ctrlurb); | 1419 | usb_free_urb(acm->ctrlurb); |
1404 | for (i = 0; i < ACM_NW; i++) | 1420 | for (i = 0; i < ACM_NW; i++) |
1405 | usb_free_urb(acm->wb[i].urb); | 1421 | usb_free_urb(acm->wb[i].urb); |