usb-serial: fix shutdown / device_unregister order

Ensure that the ->port_remove() callbacks get called before the
->shutdown() callback which makeing the order symmetric with
->attach() being called before ->port_probe().

Signed-off-by: Jim Radford <radford@blackbean.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Jim Radford and committed by Greg Kroah-Hartman d9a7ecac 4eaf60e0

+6 -5
+6 -5
drivers/usb/serial/usb-serial.c
··· 135 135 136 136 dbg("%s - %s", __FUNCTION__, serial->type->description); 137 137 138 - serial->type->shutdown(serial); 139 - 140 - /* return the minor range that this device had */ 141 - return_serial(serial); 142 - 143 138 for (i = 0; i < serial->num_ports; ++i) 144 139 serial->port[i]->open_count = 0; 145 140 ··· 144 149 device_unregister(&serial->port[i]->dev); 145 150 serial->port[i] = NULL; 146 151 } 152 + 153 + if (serial->type->shutdown) 154 + serial->type->shutdown(serial); 155 + 156 + /* return the minor range that this device had */ 157 + return_serial(serial); 147 158 148 159 /* If this is a "fake" port, we have to clean it up here, as it will 149 160 * not get cleaned up in port_release() as it was never registered with