aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/usb-serial.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index aa6b2ae951a..2d0f75d63ff 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -156,7 +156,8 @@ static void destroy_serial(struct kref *kref)
156 if (serial->minor != SERIAL_TTY_NO_MINOR) 156 if (serial->minor != SERIAL_TTY_NO_MINOR)
157 return_serial(serial); 157 return_serial(serial);
158 158
159 serial->type->release(serial); 159 if (serial->attached)
160 serial->type->release(serial);
160 161
161 /* Now that nothing is using the ports, they can be freed */ 162 /* Now that nothing is using the ports, they can be freed */
162 for (i = 0; i < serial->num_port_pointers; ++i) { 163 for (i = 0; i < serial->num_port_pointers; ++i) {
@@ -1059,12 +1060,15 @@ int usb_serial_probe(struct usb_interface *interface,
1059 module_put(type->driver.owner); 1060 module_put(type->driver.owner);
1060 if (retval < 0) 1061 if (retval < 0)
1061 goto probe_error; 1062 goto probe_error;
1063 serial->attached = 1;
1062 if (retval > 0) { 1064 if (retval > 0) {
1063 /* quietly accept this device, but don't bind to a 1065 /* quietly accept this device, but don't bind to a
1064 serial port as it's about to disappear */ 1066 serial port as it's about to disappear */
1065 serial->num_ports = 0; 1067 serial->num_ports = 0;
1066 goto exit; 1068 goto exit;
1067 } 1069 }
1070 } else {
1071 serial->attached = 1;
1068 } 1072 }
1069 1073
1070 if (get_free_serial(serial, num_ports, &minor) == NULL) { 1074 if (get_free_serial(serial, num_ports, &minor) == NULL) {