diff options
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 7 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 3 |
2 files changed, 5 insertions, 5 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 | } |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 09a3e6a7518f..655341d0f534 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | 18 | ||
19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
20 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
21 | #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */ | ||
21 | 22 | ||
22 | /* The maximum number of ports one device can grab at once */ | 23 | /* The maximum number of ports one device can grab at once */ |
23 | #define MAX_NUM_PORTS 8 | 24 | #define MAX_NUM_PORTS 8 |