diff options
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index c28f1f6902c3..ed976ab56684 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2730,7 +2730,7 @@ static int edge_startup (struct usb_serial *serial) | |||
2730 | struct edgeport_serial *edge_serial; | 2730 | struct edgeport_serial *edge_serial; |
2731 | struct edgeport_port *edge_port; | 2731 | struct edgeport_port *edge_port; |
2732 | struct usb_device *dev; | 2732 | struct usb_device *dev; |
2733 | int i; | 2733 | int i, j; |
2734 | 2734 | ||
2735 | dev = serial->dev; | 2735 | dev = serial->dev; |
2736 | 2736 | ||
@@ -2794,6 +2794,10 @@ static int edge_startup (struct usb_serial *serial) | |||
2794 | edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); | 2794 | edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); |
2795 | if (edge_port == NULL) { | 2795 | if (edge_port == NULL) { |
2796 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); | 2796 | dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); |
2797 | for (j = 0; j < i; ++j) { | ||
2798 | kfree (usb_get_serial_port_data(serial->port[j])); | ||
2799 | usb_set_serial_port_data(serial->port[j], NULL); | ||
2800 | } | ||
2797 | usb_set_serial_data(serial, NULL); | 2801 | usb_set_serial_data(serial, NULL); |
2798 | kfree(edge_serial); | 2802 | kfree(edge_serial); |
2799 | return -ENOMEM; | 2803 | return -ENOMEM; |