diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 8c2d531eedea..b157c48e8b78 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -122,9 +122,6 @@ static void return_serial(struct usb_serial *serial) | |||
122 | 122 | ||
123 | dbg("%s", __func__); | 123 | dbg("%s", __func__); |
124 | 124 | ||
125 | if (serial == NULL) | ||
126 | return; | ||
127 | |||
128 | for (i = 0; i < serial->num_ports; ++i) | 125 | for (i = 0; i < serial->num_ports; ++i) |
129 | serial_table[serial->minor + i] = NULL; | 126 | serial_table[serial->minor + i] = NULL; |
130 | } | 127 | } |
@@ -142,7 +139,8 @@ static void destroy_serial(struct kref *kref) | |||
142 | serial->type->shutdown(serial); | 139 | serial->type->shutdown(serial); |
143 | 140 | ||
144 | /* return the minor range that this device had */ | 141 | /* return the minor range that this device had */ |
145 | return_serial(serial); | 142 | if (serial->minor != SERIAL_TTY_NO_MINOR) |
143 | return_serial(serial); | ||
146 | 144 | ||
147 | for (i = 0; i < serial->num_ports; ++i) | 145 | for (i = 0; i < serial->num_ports; ++i) |
148 | serial->port[i]->port.count = 0; | 146 | serial->port[i]->port.count = 0; |
@@ -575,6 +573,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, | |||
575 | serial->interface = interface; | 573 | serial->interface = interface; |
576 | kref_init(&serial->kref); | 574 | kref_init(&serial->kref); |
577 | mutex_init(&serial->disc_mutex); | 575 | mutex_init(&serial->disc_mutex); |
576 | serial->minor = SERIAL_TTY_NO_MINOR; | ||
578 | 577 | ||
579 | return serial; | 578 | return serial; |
580 | } | 579 | } |