aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 6bf22a28adb8..7639022cdf84 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
99 continue; 99 continue;
100 100
101 *minor = i; 101 *minor = i;
102 j = 0;
102 dbg("%s - minor base = %d", __FUNCTION__, *minor); 103 dbg("%s - minor base = %d", __FUNCTION__, *minor);
103 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) 104 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
104 serial_table[i] = serial; 105 serial_table[i] = serial;
106 serial->port[j++]->number = i;
107 }
105 spin_unlock(&table_lock); 108 spin_unlock(&table_lock);
106 return serial; 109 return serial;
107 } 110 }
@@ -826,7 +829,6 @@ int usb_serial_probe(struct usb_interface *interface,
826 num_ports = type->num_ports; 829 num_ports = type->num_ports;
827 } 830 }
828 831
829 serial->minor = minor;
830 serial->num_ports = num_ports; 832 serial->num_ports = num_ports;
831 serial->num_bulk_in = num_bulk_in; 833 serial->num_bulk_in = num_bulk_in;
832 serial->num_bulk_out = num_bulk_out; 834 serial->num_bulk_out = num_bulk_out;
@@ -847,7 +849,6 @@ int usb_serial_probe(struct usb_interface *interface,
847 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); 849 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
848 if (!port) 850 if (!port)
849 goto probe_error; 851 goto probe_error;
850 port->number = i + serial->minor;
851 port->serial = serial; 852 port->serial = serial;
852 spin_lock_init(&port->lock); 853 spin_lock_init(&port->lock);
853 mutex_init(&port->mutex); 854 mutex_init(&port->mutex);
@@ -980,6 +981,7 @@ int usb_serial_probe(struct usb_interface *interface,
980 dev_err(&interface->dev, "No more free serial devices\n"); 981 dev_err(&interface->dev, "No more free serial devices\n");
981 goto probe_error; 982 goto probe_error;
982 } 983 }
984 serial->minor = minor;
983 985
984 /* register all of the individual ports with the driver core */ 986 /* register all of the individual ports with the driver core */
985 for (i = 0; i < num_ports; ++i) { 987 for (i = 0; i < num_ports; ++i) {
@@ -1034,9 +1036,6 @@ probe_error:
1034 kfree(port->interrupt_out_buffer); 1036 kfree(port->interrupt_out_buffer);
1035 } 1037 }
1036 1038
1037 /* return the minor range that this device had */
1038 return_serial (serial);
1039
1040 /* free up any memory that we allocated */ 1039 /* free up any memory that we allocated */
1041 for (i = 0; i < serial->num_port_pointers; ++i) 1040 for (i = 0; i < serial->num_port_pointers; ++i)
1042 kfree(serial->port[i]); 1041 kfree(serial->port[i]);