diff options
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index a92395bf5f5b..910247d191e8 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1108,9 +1108,11 @@ skip_normal_probe: | |||
1108 | rcv->instance = acm; | 1108 | rcv->instance = acm; |
1109 | } | 1109 | } |
1110 | for (i = 0; i < num_rx_buf; i++) { | 1110 | for (i = 0; i < num_rx_buf; i++) { |
1111 | struct acm_rb *buf = &(acm->rb[i]); | 1111 | struct acm_rb *rb = &(acm->rb[i]); |
1112 | 1112 | ||
1113 | if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { | 1113 | rb->base = usb_buffer_alloc(acm->dev, readsize, |
1114 | GFP_KERNEL, &rb->dma); | ||
1115 | if (!rb->base) { | ||
1114 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); | 1116 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); |
1115 | goto alloc_fail7; | 1117 | goto alloc_fail7; |
1116 | } | 1118 | } |
@@ -1172,6 +1174,7 @@ skip_countries: | |||
1172 | acm_set_line(acm, &acm->line); | 1174 | acm_set_line(acm, &acm->line); |
1173 | 1175 | ||
1174 | usb_driver_claim_interface(&acm_driver, data_interface, acm); | 1176 | usb_driver_claim_interface(&acm_driver, data_interface, acm); |
1177 | usb_set_intfdata(data_interface, acm); | ||
1175 | 1178 | ||
1176 | usb_get_intf(control_interface); | 1179 | usb_get_intf(control_interface); |
1177 | tty_register_device(acm_tty_driver, minor, &control_interface->dev); | 1180 | tty_register_device(acm_tty_driver, minor, &control_interface->dev); |
@@ -1221,11 +1224,11 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1221 | struct acm *acm = usb_get_intfdata(intf); | 1224 | struct acm *acm = usb_get_intfdata(intf); |
1222 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 1225 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
1223 | 1226 | ||
1224 | mutex_lock(&open_mutex); | 1227 | /* sibling interface is already cleaning up */ |
1225 | if (!acm || !acm->dev) { | 1228 | if (!acm) |
1226 | mutex_unlock(&open_mutex); | ||
1227 | return; | 1229 | return; |
1228 | } | 1230 | |
1231 | mutex_lock(&open_mutex); | ||
1229 | if (acm->country_codes){ | 1232 | if (acm->country_codes){ |
1230 | device_remove_file(&acm->control->dev, | 1233 | device_remove_file(&acm->control->dev, |
1231 | &dev_attr_wCountryCodes); | 1234 | &dev_attr_wCountryCodes); |