diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index aa6b2ae951ae..bd3fa7ff15b1 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) { |
@@ -1164,8 +1168,10 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | |||
1164 | 1168 | ||
1165 | if (serial->type->suspend) { | 1169 | if (serial->type->suspend) { |
1166 | r = serial->type->suspend(serial, message); | 1170 | r = serial->type->suspend(serial, message); |
1167 | if (r < 0) | 1171 | if (r < 0) { |
1172 | serial->suspending = 0; | ||
1168 | goto err_out; | 1173 | goto err_out; |
1174 | } | ||
1169 | } | 1175 | } |
1170 | 1176 | ||
1171 | for (i = 0; i < serial->num_ports; ++i) { | 1177 | for (i = 0; i < serial->num_ports; ++i) { |