aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c56
1 files changed, 16 insertions, 40 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 2b3b7bfeb332..a673f4b25b08 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -364,11 +364,9 @@ static int write_boot_mem(struct edgeport_serial *serial,
364 /* Must do a read before write */ 364 /* Must do a read before write */
365 if (!serial->TiReadI2C) { 365 if (!serial->TiReadI2C) {
366 temp = kmalloc(1, GFP_KERNEL); 366 temp = kmalloc(1, GFP_KERNEL);
367 if (!temp) { 367 if (!temp)
368 dev_err(&serial->serial->dev->dev,
369 "%s - out of memory\n", __func__);
370 return -ENOMEM; 368 return -ENOMEM;
371 } 369
372 status = read_boot_mem(serial, 0, 1, temp); 370 status = read_boot_mem(serial, 0, 1, temp);
373 kfree(temp); 371 kfree(temp);
374 if (status) 372 if (status)
@@ -471,10 +469,8 @@ static int tx_active(struct edgeport_port *port)
471 int bytes_left = 0; 469 int bytes_left = 0;
472 470
473 oedb = kmalloc(sizeof(*oedb), GFP_KERNEL); 471 oedb = kmalloc(sizeof(*oedb), GFP_KERNEL);
474 if (!oedb) { 472 if (!oedb)
475 dev_err(&port->port->dev, "%s - out of memory\n", __func__);
476 return -ENOMEM; 473 return -ENOMEM;
477 }
478 474
479 lsr = kmalloc(1, GFP_KERNEL); /* Sigh, that's right, just one byte, 475 lsr = kmalloc(1, GFP_KERNEL); /* Sigh, that's right, just one byte,
480 as not all platforms can do DMA 476 as not all platforms can do DMA
@@ -625,14 +621,11 @@ static int check_i2c_image(struct edgeport_serial *serial)
625 __u16 ttype; 621 __u16 ttype;
626 622
627 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); 623 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
628 if (!rom_desc) { 624 if (!rom_desc)
629 dev_err(dev, "%s - out of memory\n", __func__);
630 return -ENOMEM; 625 return -ENOMEM;
631 } 626
632 buffer = kmalloc(TI_MAX_I2C_SIZE, GFP_KERNEL); 627 buffer = kmalloc(TI_MAX_I2C_SIZE, GFP_KERNEL);
633 if (!buffer) { 628 if (!buffer) {
634 dev_err(dev, "%s - out of memory when allocating buffer\n",
635 __func__);
636 kfree(rom_desc); 629 kfree(rom_desc);
637 return -ENOMEM; 630 return -ENOMEM;
638 } 631 }
@@ -706,10 +699,9 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
706 struct device *dev = &serial->serial->dev->dev; 699 struct device *dev = &serial->serial->dev->dev;
707 700
708 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); 701 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
709 if (!rom_desc) { 702 if (!rom_desc)
710 dev_err(dev, "%s - out of memory\n", __func__);
711 return -ENOMEM; 703 return -ENOMEM;
712 } 704
713 start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, 705 start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
714 rom_desc); 706 rom_desc);
715 707
@@ -769,10 +761,8 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev)
769 sizeof(struct ti_i2c_firmware_rec)); 761 sizeof(struct ti_i2c_firmware_rec));
770 762
771 buffer = kmalloc(buffer_size, GFP_KERNEL); 763 buffer = kmalloc(buffer_size, GFP_KERNEL);
772 if (!buffer) { 764 if (!buffer)
773 dev_err(dev, "%s - out of memory\n", __func__);
774 return -ENOMEM; 765 return -ENOMEM;
775 }
776 766
777 // Set entire image of 0xffs 767 // Set entire image of 0xffs
778 memset(buffer, 0xff, buffer_size); 768 memset(buffer, 0xff, buffer_size);
@@ -832,10 +822,8 @@ static int i2c_type_bootmode(struct edgeport_serial *serial)
832 u8 *data; 822 u8 *data;
833 823
834 data = kmalloc(1, GFP_KERNEL); 824 data = kmalloc(1, GFP_KERNEL);
835 if (!data) { 825 if (!data)
836 dev_err(dev, "%s - out of memory\n", __func__);
837 return -ENOMEM; 826 return -ENOMEM;
838 }
839 827
840 /* Try to read type 2 */ 828 /* Try to read type 2 */
841 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, 829 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
@@ -986,10 +974,9 @@ static int download_fw(struct edgeport_serial *serial)
986 * Read Manufacturing Descriptor from TI Based Edgeport 974 * Read Manufacturing Descriptor from TI Based Edgeport
987 */ 975 */
988 ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL); 976 ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
989 if (!ti_manuf_desc) { 977 if (!ti_manuf_desc)
990 dev_err(dev, "%s - out of memory.\n", __func__);
991 return -ENOMEM; 978 return -ENOMEM;
992 } 979
993 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); 980 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
994 if (status) { 981 if (status) {
995 kfree(ti_manuf_desc); 982 kfree(ti_manuf_desc);
@@ -1006,7 +993,6 @@ static int download_fw(struct edgeport_serial *serial)
1006 993
1007 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); 994 rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
1008 if (!rom_desc) { 995 if (!rom_desc) {
1009 dev_err(dev, "%s - out of memory.\n", __func__);
1010 kfree(ti_manuf_desc); 996 kfree(ti_manuf_desc);
1011 return -ENOMEM; 997 return -ENOMEM;
1012 } 998 }
@@ -1023,7 +1009,6 @@ static int download_fw(struct edgeport_serial *serial)
1023 firmware_version = kmalloc(sizeof(*firmware_version), 1009 firmware_version = kmalloc(sizeof(*firmware_version),
1024 GFP_KERNEL); 1010 GFP_KERNEL);
1025 if (!firmware_version) { 1011 if (!firmware_version) {
1026 dev_err(dev, "%s - out of memory.\n", __func__);
1027 kfree(rom_desc); 1012 kfree(rom_desc);
1028 kfree(ti_manuf_desc); 1013 kfree(ti_manuf_desc);
1029 return -ENOMEM; 1014 return -ENOMEM;
@@ -1068,8 +1053,6 @@ static int download_fw(struct edgeport_serial *serial)
1068 1053
1069 record = kmalloc(1, GFP_KERNEL); 1054 record = kmalloc(1, GFP_KERNEL);
1070 if (!record) { 1055 if (!record) {
1071 dev_err(dev, "%s - out of memory.\n",
1072 __func__);
1073 kfree(firmware_version); 1056 kfree(firmware_version);
1074 kfree(rom_desc); 1057 kfree(rom_desc);
1075 kfree(ti_manuf_desc); 1058 kfree(ti_manuf_desc);
@@ -1153,7 +1136,6 @@ static int download_fw(struct edgeport_serial *serial)
1153 1136
1154 header = kmalloc(HEADER_SIZE, GFP_KERNEL); 1137 header = kmalloc(HEADER_SIZE, GFP_KERNEL);
1155 if (!header) { 1138 if (!header) {
1156 dev_err(dev, "%s - out of memory.\n", __func__);
1157 kfree(rom_desc); 1139 kfree(rom_desc);
1158 kfree(ti_manuf_desc); 1140 kfree(ti_manuf_desc);
1159 return -ENOMEM; 1141 return -ENOMEM;
@@ -1161,7 +1143,6 @@ static int download_fw(struct edgeport_serial *serial)
1161 1143
1162 vheader = kmalloc(HEADER_SIZE, GFP_KERNEL); 1144 vheader = kmalloc(HEADER_SIZE, GFP_KERNEL);
1163 if (!vheader) { 1145 if (!vheader) {
1164 dev_err(dev, "%s - out of memory.\n", __func__);
1165 kfree(header); 1146 kfree(header);
1166 kfree(rom_desc); 1147 kfree(rom_desc);
1167 kfree(ti_manuf_desc); 1148 kfree(ti_manuf_desc);
@@ -1290,10 +1271,9 @@ static int download_fw(struct edgeport_serial *serial)
1290 * Read Manufacturing Descriptor from TI Based Edgeport 1271 * Read Manufacturing Descriptor from TI Based Edgeport
1291 */ 1272 */
1292 ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL); 1273 ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
1293 if (!ti_manuf_desc) { 1274 if (!ti_manuf_desc)
1294 dev_err(dev, "%s - out of memory.\n", __func__);
1295 return -ENOMEM; 1275 return -ENOMEM;
1296 } 1276
1297 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); 1277 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
1298 if (status) { 1278 if (status) {
1299 kfree(ti_manuf_desc); 1279 kfree(ti_manuf_desc);
@@ -1328,10 +1308,8 @@ static int download_fw(struct edgeport_serial *serial)
1328 buffer_size = (((1024 * 16) - 512) + 1308 buffer_size = (((1024 * 16) - 512) +
1329 sizeof(struct ti_i2c_image_header)); 1309 sizeof(struct ti_i2c_image_header));
1330 buffer = kmalloc(buffer_size, GFP_KERNEL); 1310 buffer = kmalloc(buffer_size, GFP_KERNEL);
1331 if (!buffer) { 1311 if (!buffer)
1332 dev_err(dev, "%s - out of memory\n", __func__);
1333 return -ENOMEM; 1312 return -ENOMEM;
1334 }
1335 1313
1336 /* Initialize the buffer to 0xff (pad the buffer) */ 1314 /* Initialize the buffer to 0xff (pad the buffer) */
1337 memset(buffer, 0xff, buffer_size); 1315 memset(buffer, 0xff, buffer_size);
@@ -2122,7 +2100,6 @@ static void change_port_settings(struct tty_struct *tty,
2122 config = kmalloc (sizeof (*config), GFP_KERNEL); 2100 config = kmalloc (sizeof (*config), GFP_KERNEL);
2123 if (!config) { 2101 if (!config) {
2124 tty->termios = *old_termios; 2102 tty->termios = *old_termios;
2125 dev_err(dev, "%s - out of memory\n", __func__);
2126 return; 2103 return;
2127 } 2104 }
2128 2105
@@ -2393,10 +2370,9 @@ static int edge_startup(struct usb_serial *serial)
2393 2370
2394 /* create our private serial structure */ 2371 /* create our private serial structure */
2395 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); 2372 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
2396 if (edge_serial == NULL) { 2373 if (!edge_serial)
2397 dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
2398 return -ENOMEM; 2374 return -ENOMEM;
2399 } 2375
2400 mutex_init(&edge_serial->es_lock); 2376 mutex_init(&edge_serial->es_lock);
2401 edge_serial->serial = serial; 2377 edge_serial->serial = serial;
2402 usb_set_serial_data(serial, edge_serial); 2378 usb_set_serial_data(serial, edge_serial);