diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-10-13 11:27:08 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-10-13 11:27:08 +0900 |
commit | 95019b48addc014c7de6653517663527a1747fb7 (patch) | |
tree | 5488066e45e8e9de1fef431f39a93cd2d5967b61 /drivers/usb/serial/usb-serial.c | |
parent | 7a0064d67215c53dce56839c82db504d0a066b79 (diff) | |
parent | 964f7e5a56814b32c727821de77d22bd7ef782bc (diff) |
Merge branch 'sh/stable-updates'
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 aa6b2ae951a..bd3fa7ff15b 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) if (serial->minor != SERIAL_TTY_NO_MINOR) return_serial(serial); - serial->type->release(serial); + if (serial->attached) + serial->type->release(serial); /* Now that nothing is using the ports, they can be freed */ for (i = 0; i < serial->num_port_pointers; ++i) { @@ -1059,12 +1060,15 @@ int usb_serial_probe(struct usb_interface *interface, module_put(type->driver.owner); if (retval < 0) goto probe_error; + serial->attached = 1; if (retval > 0) { /* quietly accept this device, but don't bind to a serial port as it's about to disappear */ serial->num_ports = 0; goto exit; } + } else { + serial->attached = 1; } 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) if (serial->type->suspend) { r = serial->type->suspend(serial, message); - if (r < 0) + if (r < 0) { + serial->suspending = 0; goto err_out; + } } for (i = 0; i < serial->num_ports; ++i) { |