aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-12-29 13:22:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-03 15:31:46 -0500
commit10c642d0772ac1391ae4f9fdeb13217ab019117a (patch)
treef7fe3b80ca13ff03fde6ec4b5d46aa1063a4c4dc /drivers/usb/serial
parent4d5147ec90531d11e7677e2c38941fc18e160641 (diff)
USB: serial: remove redundant OOM messages
Remove redundant error messages on allocation failures, which have already been logged. Cc: Joe Perches <joe@perches.com> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/ch341.c4
-rw-r--r--drivers/usb/serial/console.c2
-rw-r--r--drivers/usb/serial/cp210x.c8
-rw-r--r--drivers/usb/serial/ftdi_sio.c5
-rw-r--r--drivers/usb/serial/garmin_gps.c15
-rw-r--r--drivers/usb/serial/io_edgeport.c48
-rw-r--r--drivers/usb/serial/io_ti.c56
-rw-r--r--drivers/usb/serial/ir-usb.c9
-rw-r--r--drivers/usb/serial/keyspan.c8
-rw-r--r--drivers/usb/serial/kl5kusb105.c16
-rw-r--r--drivers/usb/serial/mos7720.c26
-rw-r--r--drivers/usb/serial/mos7840.c18
-rw-r--r--drivers/usb/serial/opticon.c4
-rw-r--r--drivers/usb/serial/oti6858.c13
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/quatech2.c8
-rw-r--r--drivers/usb/serial/sierra.c10
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c18
-rw-r--r--drivers/usb/serial/usb_wwan.c6
-rw-r--r--drivers/usb/serial/visor.c10
-rw-r--r--drivers/usb/serial/whiteheat.c6
21 files changed, 74 insertions, 217 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index c2a4171ab9cb..8908760cca9f 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -384,10 +384,8 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
384 uint8_t *break_reg; 384 uint8_t *break_reg;
385 385
386 break_reg = kmalloc(2, GFP_KERNEL); 386 break_reg = kmalloc(2, GFP_KERNEL);
387 if (!break_reg) { 387 if (!break_reg)
388 dev_err(&port->dev, "%s - kmalloc failed\n", __func__);
389 return; 388 return;
390 }
391 389
392 r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG, 390 r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
393 ch341_break_reg, 0, break_reg, 2); 391 ch341_break_reg, 0, break_reg, 2);
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index c69bb50d4663..b5b8dcbb33a2 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -135,7 +135,6 @@ static int usb_console_setup(struct console *co, char *options)
135 tty = kzalloc(sizeof(*tty), GFP_KERNEL); 135 tty = kzalloc(sizeof(*tty), GFP_KERNEL);
136 if (!tty) { 136 if (!tty) {
137 retval = -ENOMEM; 137 retval = -ENOMEM;
138 dev_err(&port->dev, "no more memory\n");
139 goto reset_open_count; 138 goto reset_open_count;
140 } 139 }
141 kref_init(&tty->kref); 140 kref_init(&tty->kref);
@@ -144,7 +143,6 @@ static int usb_console_setup(struct console *co, char *options)
144 tty->index = co->index; 143 tty->index = co->index;
145 if (tty_init_termios(tty)) { 144 if (tty_init_termios(tty)) {
146 retval = -ENOMEM; 145 retval = -ENOMEM;
147 dev_err(&port->dev, "no more memory\n");
148 goto free_tty; 146 goto free_tty;
149 } 147 }
150 } 148 }
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 6987b535aa98..95fa1217afdd 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -305,10 +305,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
305 length = (((size - 1) | 3) + 1) / 4; 305 length = (((size - 1) | 3) + 1) / 4;
306 306
307 buf = kcalloc(length, sizeof(__le32), GFP_KERNEL); 307 buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
308 if (!buf) { 308 if (!buf)
309 dev_err(&port->dev, "%s - out of memory.\n", __func__);
310 return -ENOMEM; 309 return -ENOMEM;
311 }
312 310
313 /* Issue the request, attempting to read 'size' bytes */ 311 /* Issue the request, attempting to read 'size' bytes */
314 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 312 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
@@ -352,10 +350,8 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
352 length = (((size - 1) | 3) + 1) / 4; 350 length = (((size - 1) | 3) + 1) / 4;
353 351
354 buf = kmalloc(length * sizeof(__le32), GFP_KERNEL); 352 buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
355 if (!buf) { 353 if (!buf)
356 dev_err(&port->dev, "%s - out of memory.\n", __func__);
357 return -ENOMEM; 354 return -ENOMEM;
358 }
359 355
360 /* Array of integers into bytes */ 356 /* Array of integers into bytes */
361 for (i = 0; i < length; i++) 357 for (i = 0; i < length; i++)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b3f712f8cf17..a4bebacc5cae 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1695,11 +1695,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1695 1695
1696 1696
1697 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); 1697 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
1698 if (!priv) { 1698 if (!priv)
1699 dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
1700 sizeof(struct ftdi_private));
1701 return -ENOMEM; 1699 return -ENOMEM;
1702 }
1703 1700
1704 mutex_init(&priv->cfg_lock); 1701 mutex_init(&priv->cfg_lock);
1705 1702
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 04b5ed90ffb2..f4ee74da44e8 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -279,10 +279,9 @@ static int pkt_add(struct garmin_data *garmin_data_p,
279 if (data_length) { 279 if (data_length) {
280 pkt = kmalloc(sizeof(struct garmin_packet)+data_length, 280 pkt = kmalloc(sizeof(struct garmin_packet)+data_length,
281 GFP_ATOMIC); 281 GFP_ATOMIC);
282 if (pkt == NULL) { 282 if (!pkt)
283 dev_err(&garmin_data_p->port->dev, "out of memory\n");
284 return 0; 283 return 0;
285 } 284
286 pkt->size = data_length; 285 pkt->size = data_length;
287 memcpy(pkt->data, data, data_length); 286 memcpy(pkt->data, data, data_length);
288 287
@@ -1006,14 +1005,11 @@ static int garmin_write_bulk(struct usb_serial_port *port,
1006 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1005 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1007 1006
1008 buffer = kmalloc(count, GFP_ATOMIC); 1007 buffer = kmalloc(count, GFP_ATOMIC);
1009 if (!buffer) { 1008 if (!buffer)
1010 dev_err(&port->dev, "out of memory\n");
1011 return -ENOMEM; 1009 return -ENOMEM;
1012 }
1013 1010
1014 urb = usb_alloc_urb(0, GFP_ATOMIC); 1011 urb = usb_alloc_urb(0, GFP_ATOMIC);
1015 if (!urb) { 1012 if (!urb) {
1016 dev_err(&port->dev, "no more free urbs\n");
1017 kfree(buffer); 1013 kfree(buffer);
1018 return -ENOMEM; 1014 return -ENOMEM;
1019 } 1015 }
@@ -1393,10 +1389,9 @@ static int garmin_port_probe(struct usb_serial_port *port)
1393 struct garmin_data *garmin_data_p; 1389 struct garmin_data *garmin_data_p;
1394 1390
1395 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); 1391 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
1396 if (garmin_data_p == NULL) { 1392 if (!garmin_data_p)
1397 dev_err(&port->dev, "%s - Out of memory\n", __func__);
1398 return -ENOMEM; 1393 return -ENOMEM;
1399 } 1394
1400 init_timer(&garmin_data_p->timer); 1395 init_timer(&garmin_data_p->timer);
1401 spin_lock_init(&garmin_data_p->lock); 1396 spin_lock_init(&garmin_data_p->lock);
1402 INIT_LIST_HEAD(&garmin_data_p->pktlist); 1397 INIT_LIST_HEAD(&garmin_data_p->pktlist);
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 9c79fb22f341..0dd8cce9c9d3 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -898,7 +898,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
898 edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); 898 edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL);
899 899
900 if (!edge_port->txfifo.fifo) { 900 if (!edge_port->txfifo.fifo) {
901 dev_dbg(dev, "%s - no memory\n", __func__);
902 edge_close(port); 901 edge_close(port);
903 return -ENOMEM; 902 return -ENOMEM;
904 } 903 }
@@ -908,7 +907,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
908 edge_port->write_in_progress = false; 907 edge_port->write_in_progress = false;
909 908
910 if (!edge_port->write_urb) { 909 if (!edge_port->write_urb) {
911 dev_dbg(dev, "%s - no memory\n", __func__);
912 edge_close(port); 910 edge_close(port);
913 return -ENOMEM; 911 return -ENOMEM;
914 } 912 }
@@ -1245,9 +1243,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
1245 to send out */ 1243 to send out */
1246 count = fifo->count; 1244 count = fifo->count;
1247 buffer = kmalloc(count+2, GFP_ATOMIC); 1245 buffer = kmalloc(count+2, GFP_ATOMIC);
1248 if (buffer == NULL) { 1246 if (!buffer) {
1249 dev_err_console(edge_port->port,
1250 "%s - no more kernel memory...\n", __func__);
1251 edge_port->write_in_progress = false; 1247 edge_port->write_in_progress = false;
1252 goto exit_send; 1248 goto exit_send;
1253 } 1249 }
@@ -2025,11 +2021,8 @@ static int sram_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
2025 dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length); 2021 dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length);
2026 2022
2027 transfer_buffer = kmalloc(64, GFP_KERNEL); 2023 transfer_buffer = kmalloc(64, GFP_KERNEL);
2028 if (!transfer_buffer) { 2024 if (!transfer_buffer)
2029 dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
2030 __func__, 64);
2031 return -ENOMEM; 2025 return -ENOMEM;
2032 }
2033 2026
2034 /* need to split these writes up into 64 byte chunks */ 2027 /* need to split these writes up into 64 byte chunks */
2035 result = 0; 2028 result = 0;
@@ -2073,11 +2066,8 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
2073 unsigned char *transfer_buffer; 2066 unsigned char *transfer_buffer;
2074 2067
2075 transfer_buffer = kmalloc(64, GFP_KERNEL); 2068 transfer_buffer = kmalloc(64, GFP_KERNEL);
2076 if (!transfer_buffer) { 2069 if (!transfer_buffer)
2077 dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
2078 __func__, 64);
2079 return -ENOMEM; 2070 return -ENOMEM;
2080 }
2081 2071
2082 /* need to split these writes up into 64 byte chunks */ 2072 /* need to split these writes up into 64 byte chunks */
2083 result = 0; 2073 result = 0;
@@ -2119,11 +2109,8 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr,
2119 unsigned char *transfer_buffer; 2109 unsigned char *transfer_buffer;
2120 2110
2121 transfer_buffer = kmalloc(64, GFP_KERNEL); 2111 transfer_buffer = kmalloc(64, GFP_KERNEL);
2122 if (!transfer_buffer) { 2112 if (!transfer_buffer)
2123 dev_err(&serial->dev->dev,
2124 "%s - kmalloc(%d) failed.\n", __func__, 64);
2125 return -ENOMEM; 2113 return -ENOMEM;
2126 }
2127 2114
2128 /* need to split these reads up into 64 byte chunks */ 2115 /* need to split these reads up into 64 byte chunks */
2129 result = 0; 2116 result = 0;
@@ -2163,11 +2150,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port,
2163 int status = 0; 2150 int status = 0;
2164 2151
2165 buffer = kmalloc(10, GFP_ATOMIC); 2152 buffer = kmalloc(10, GFP_ATOMIC);
2166 if (!buffer) { 2153 if (!buffer)
2167 dev_err(&edge_port->port->dev,
2168 "%s - kmalloc(%d) failed.\n", __func__, 10);
2169 return -ENOMEM; 2154 return -ENOMEM;
2170 }
2171 2155
2172 currentCommand = buffer; 2156 currentCommand = buffer;
2173 2157
@@ -2274,10 +2258,9 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port,
2274 2258
2275 /* Alloc memory for the string of commands. */ 2259 /* Alloc memory for the string of commands. */
2276 cmdBuffer = kmalloc(0x100, GFP_ATOMIC); 2260 cmdBuffer = kmalloc(0x100, GFP_ATOMIC);
2277 if (!cmdBuffer) { 2261 if (!cmdBuffer)
2278 dev_err(dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100);
2279 return -ENOMEM; 2262 return -ENOMEM;
2280 } 2263
2281 currCmd = cmdBuffer; 2264 currCmd = cmdBuffer;
2282 2265
2283 /* Enable access to divisor latch */ 2266 /* Enable access to divisor latch */
@@ -2783,10 +2766,9 @@ static int edge_startup(struct usb_serial *serial)
2783 2766
2784 /* create our private serial structure */ 2767 /* create our private serial structure */
2785 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); 2768 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
2786 if (edge_serial == NULL) { 2769 if (!edge_serial)
2787 dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
2788 return -ENOMEM; 2770 return -ENOMEM;
2789 } 2771
2790 spin_lock_init(&edge_serial->es_lock); 2772 spin_lock_init(&edge_serial->es_lock);
2791 edge_serial->serial = serial; 2773 edge_serial->serial = serial;
2792 usb_set_serial_data(serial, edge_serial); 2774 usb_set_serial_data(serial, edge_serial);
@@ -2875,14 +2857,12 @@ static int edge_startup(struct usb_serial *serial)
2875 /* not set up yet, so do it now */ 2857 /* not set up yet, so do it now */
2876 edge_serial->interrupt_read_urb = 2858 edge_serial->interrupt_read_urb =
2877 usb_alloc_urb(0, GFP_KERNEL); 2859 usb_alloc_urb(0, GFP_KERNEL);
2878 if (!edge_serial->interrupt_read_urb) { 2860 if (!edge_serial->interrupt_read_urb)
2879 dev_err(ddev, "out of memory\n");
2880 return -ENOMEM; 2861 return -ENOMEM;
2881 } 2862
2882 edge_serial->interrupt_in_buffer = 2863 edge_serial->interrupt_in_buffer =
2883 kmalloc(buffer_size, GFP_KERNEL); 2864 kmalloc(buffer_size, GFP_KERNEL);
2884 if (!edge_serial->interrupt_in_buffer) { 2865 if (!edge_serial->interrupt_in_buffer) {
2885 dev_err(ddev, "out of memory\n");
2886 usb_free_urb(edge_serial->interrupt_read_urb); 2866 usb_free_urb(edge_serial->interrupt_read_urb);
2887 return -ENOMEM; 2867 return -ENOMEM;
2888 } 2868 }
@@ -2912,14 +2892,12 @@ static int edge_startup(struct usb_serial *serial)
2912 /* not set up yet, so do it now */ 2892 /* not set up yet, so do it now */
2913 edge_serial->read_urb = 2893 edge_serial->read_urb =
2914 usb_alloc_urb(0, GFP_KERNEL); 2894 usb_alloc_urb(0, GFP_KERNEL);
2915 if (!edge_serial->read_urb) { 2895 if (!edge_serial->read_urb)
2916 dev_err(ddev, "out of memory\n");
2917 return -ENOMEM; 2896 return -ENOMEM;
2918 } 2897
2919 edge_serial->bulk_in_buffer = 2898 edge_serial->bulk_in_buffer =
2920 kmalloc(buffer_size, GFP_KERNEL); 2899 kmalloc(buffer_size, GFP_KERNEL);
2921 if (!edge_serial->bulk_in_buffer) { 2900 if (!edge_serial->bulk_in_buffer) {
2922 dev_err(&dev->dev, "out of memory\n");
2923 usb_free_urb(edge_serial->read_urb); 2901 usb_free_urb(edge_serial->read_urb);
2924 return -ENOMEM; 2902 return -ENOMEM;
2925 } 2903 }
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);
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 716930ab1bb1..73956d48a0c5 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -377,15 +377,12 @@ static void ir_set_termios(struct tty_struct *tty,
377 * send the baud change out on an "empty" data packet 377 * send the baud change out on an "empty" data packet
378 */ 378 */
379 urb = usb_alloc_urb(0, GFP_KERNEL); 379 urb = usb_alloc_urb(0, GFP_KERNEL);
380 if (!urb) { 380 if (!urb)
381 dev_err(&port->dev, "%s - no more urbs\n", __func__);
382 return; 381 return;
383 } 382
384 transfer_buffer = kmalloc(1, GFP_KERNEL); 383 transfer_buffer = kmalloc(1, GFP_KERNEL);
385 if (!transfer_buffer) { 384 if (!transfer_buffer)
386 dev_err(&port->dev, "%s - out of memory\n", __func__);
387 goto err_buf; 385 goto err_buf;
388 }
389 386
390 *transfer_buffer = ir_xbof | ir_baud; 387 *transfer_buffer = ir_xbof | ir_baud;
391 388
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index d6960aebe246..6125fce7d0f6 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1226,10 +1226,8 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
1226 1226
1227 dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint); 1227 dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint);
1228 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ 1228 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
1229 if (urb == NULL) { 1229 if (!urb)
1230 dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d failed.\n", __func__, endpoint);
1231 return NULL; 1230 return NULL;
1232 }
1233 1231
1234 if (endpoint == 0) { 1232 if (endpoint == 0) {
1235 /* control EP filled in when used */ 1233 /* control EP filled in when used */
@@ -2312,10 +2310,8 @@ static int keyspan_startup(struct usb_serial *serial)
2312 2310
2313 /* Setup private data for serial driver */ 2311 /* Setup private data for serial driver */
2314 s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); 2312 s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
2315 if (!s_priv) { 2313 if (!s_priv)
2316 dev_dbg(&serial->dev->dev, "%s - kmalloc for keyspan_serial_private failed.\n", __func__);
2317 return -ENOMEM; 2314 return -ENOMEM;
2318 }
2319 2315
2320 s_priv->instat_buf = kzalloc(INSTAT_BUFLEN, GFP_KERNEL); 2316 s_priv->instat_buf = kzalloc(INSTAT_BUFLEN, GFP_KERNEL);
2321 if (!s_priv->instat_buf) 2317 if (!s_priv->instat_buf)
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 1b4054fe52a5..4f441c2c0668 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -182,11 +182,9 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
182 dev_info(&port->serial->dev->dev, "sending SIO Poll request\n"); 182 dev_info(&port->serial->dev->dev, "sending SIO Poll request\n");
183 183
184 status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL); 184 status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL);
185 if (!status_buf) { 185 if (!status_buf)
186 dev_err(&port->dev, "%s - out of memory for status buffer.\n",
187 __func__);
188 return -ENOMEM; 186 return -ENOMEM;
189 } 187
190 status_buf[0] = 0xff; 188 status_buf[0] = 0xff;
191 status_buf[1] = 0xff; 189 status_buf[1] = 0xff;
192 rc = usb_control_msg(port->serial->dev, 190 rc = usb_control_msg(port->serial->dev,
@@ -273,11 +271,9 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
273 * priv->line_state. 271 * priv->line_state.
274 */ 272 */
275 cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 273 cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
276 if (!cfg) { 274 if (!cfg)
277 dev_err(&port->dev, "%s - out of memory for config buffer.\n",
278 __func__);
279 return -ENOMEM; 275 return -ENOMEM;
280 } 276
281 cfg->pktlen = 5; 277 cfg->pktlen = 5;
282 cfg->baudrate = kl5kusb105a_sio_b9600; 278 cfg->baudrate = kl5kusb105a_sio_b9600;
283 cfg->databits = kl5kusb105a_dtb_8; 279 cfg->databits = kl5kusb105a_dtb_8;
@@ -417,10 +413,8 @@ static void klsi_105_set_termios(struct tty_struct *tty,
417 speed_t baud; 413 speed_t baud;
418 414
419 cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 415 cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
420 if (!cfg) { 416 if (!cfg)
421 dev_err(dev, "%s - out of memory for config buffer.\n", __func__);
422 return; 417 return;
423 }
424 418
425 /* lock while we are modifying the settings */ 419 /* lock while we are modifying the settings */
426 spin_lock_irqsave(&priv->lock, flags); 420 spin_lock_irqsave(&priv->lock, flags);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index b739a1732b76..ee68191e87c6 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -362,15 +362,13 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
362 362
363 /* create and initialize the control urb and containing urbtracker */ 363 /* create and initialize the control urb and containing urbtracker */
364 urbtrack = kmalloc(sizeof(struct urbtracker), GFP_ATOMIC); 364 urbtrack = kmalloc(sizeof(struct urbtracker), GFP_ATOMIC);
365 if (urbtrack == NULL) { 365 if (!urbtrack)
366 dev_err(&usbdev->dev, "out of memory");
367 return -ENOMEM; 366 return -ENOMEM;
368 } 367
369 kref_get(&mos_parport->ref_count); 368 kref_get(&mos_parport->ref_count);
370 urbtrack->mos_parport = mos_parport; 369 urbtrack->mos_parport = mos_parport;
371 urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); 370 urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC);
372 if (urbtrack->urb == NULL) { 371 if (!urbtrack->urb) {
373 dev_err(&usbdev->dev, "out of urbs");
374 kfree(urbtrack); 372 kfree(urbtrack);
375 return -ENOMEM; 373 return -ENOMEM;
376 } 374 }
@@ -702,10 +700,9 @@ static int mos7715_parport_init(struct usb_serial *serial)
702 700
703 /* allocate and initialize parallel port control struct */ 701 /* allocate and initialize parallel port control struct */
704 mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL); 702 mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
705 if (mos_parport == NULL) { 703 if (!mos_parport)
706 dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
707 return -ENOMEM; 704 return -ENOMEM;
708 } 705
709 mos_parport->msg_pending = false; 706 mos_parport->msg_pending = false;
710 kref_init(&mos_parport->ref_count); 707 kref_init(&mos_parport->ref_count);
711 spin_lock_init(&mos_parport->listlock); 708 spin_lock_init(&mos_parport->listlock);
@@ -1018,18 +1015,12 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
1018 for (j = 0; j < NUM_URBS; ++j) { 1015 for (j = 0; j < NUM_URBS; ++j) {
1019 urb = usb_alloc_urb(0, GFP_KERNEL); 1016 urb = usb_alloc_urb(0, GFP_KERNEL);
1020 mos7720_port->write_urb_pool[j] = urb; 1017 mos7720_port->write_urb_pool[j] = urb;
1021 1018 if (!urb)
1022 if (urb == NULL) {
1023 dev_err(&port->dev, "No more urbs???\n");
1024 continue; 1019 continue;
1025 }
1026 1020
1027 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 1021 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
1028 GFP_KERNEL); 1022 GFP_KERNEL);
1029 if (!urb->transfer_buffer) { 1023 if (!urb->transfer_buffer) {
1030 dev_err(&port->dev,
1031 "%s-out of memory for urb buffers.\n",
1032 __func__);
1033 usb_free_urb(mos7720_port->write_urb_pool[j]); 1024 usb_free_urb(mos7720_port->write_urb_pool[j]);
1034 mos7720_port->write_urb_pool[j] = NULL; 1025 mos7720_port->write_urb_pool[j] = NULL;
1035 continue; 1026 continue;
@@ -1250,11 +1241,8 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
1250 if (urb->transfer_buffer == NULL) { 1241 if (urb->transfer_buffer == NULL) {
1251 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 1242 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
1252 GFP_KERNEL); 1243 GFP_KERNEL);
1253 if (urb->transfer_buffer == NULL) { 1244 if (!urb->transfer_buffer)
1254 dev_err_console(port, "%s no more kernel memory...\n",
1255 __func__);
1256 goto exit; 1245 goto exit;
1257 }
1258 } 1246 }
1259 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); 1247 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
1260 1248
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index bc176ae61743..2496e71e406a 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -876,20 +876,14 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
876 for (j = 0; j < NUM_URBS; ++j) { 876 for (j = 0; j < NUM_URBS; ++j) {
877 urb = usb_alloc_urb(0, GFP_KERNEL); 877 urb = usb_alloc_urb(0, GFP_KERNEL);
878 mos7840_port->write_urb_pool[j] = urb; 878 mos7840_port->write_urb_pool[j] = urb;
879 879 if (!urb)
880 if (urb == NULL) {
881 dev_err(&port->dev, "No more urbs???\n");
882 continue; 880 continue;
883 }
884 881
885 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 882 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
886 GFP_KERNEL); 883 GFP_KERNEL);
887 if (!urb->transfer_buffer) { 884 if (!urb->transfer_buffer) {
888 usb_free_urb(urb); 885 usb_free_urb(urb);
889 mos7840_port->write_urb_pool[j] = NULL; 886 mos7840_port->write_urb_pool[j] = NULL;
890 dev_err(&port->dev,
891 "%s-out of memory for urb buffers.\n",
892 __func__);
893 continue; 887 continue;
894 } 888 }
895 } 889 }
@@ -1381,12 +1375,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
1381 if (urb->transfer_buffer == NULL) { 1375 if (urb->transfer_buffer == NULL) {
1382 urb->transfer_buffer = 1376 urb->transfer_buffer =
1383 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 1377 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
1384 1378 if (!urb->transfer_buffer)
1385 if (urb->transfer_buffer == NULL) {
1386 dev_err_console(port, "%s no more kernel memory...\n",
1387 __func__);
1388 goto exit; 1379 goto exit;
1389 }
1390 } 1380 }
1391 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); 1381 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
1392 1382
@@ -2206,10 +2196,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
2206 2196
2207 dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); 2197 dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
2208 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); 2198 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
2209 if (mos7840_port == NULL) { 2199 if (!mos7840_port)
2210 dev_err(&port->dev, "%s - Out of memory\n", __func__);
2211 return -ENOMEM; 2200 return -ENOMEM;
2212 }
2213 2201
2214 /* Initialize all port interrupt end point to port 0 int 2202 /* Initialize all port interrupt end point to port 0 int
2215 * endpoint. Our device has only one interrupt end point 2203 * endpoint. Our device has only one interrupt end point
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 1b4f1d2479c1..90c77b20c883 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -200,15 +200,12 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
200 200
201 buffer = kmalloc(count, GFP_ATOMIC); 201 buffer = kmalloc(count, GFP_ATOMIC);
202 if (!buffer) { 202 if (!buffer) {
203 dev_err(&port->dev, "out of memory\n");
204 count = -ENOMEM; 203 count = -ENOMEM;
205
206 goto error_no_buffer; 204 goto error_no_buffer;
207 } 205 }
208 206
209 urb = usb_alloc_urb(0, GFP_ATOMIC); 207 urb = usb_alloc_urb(0, GFP_ATOMIC);
210 if (!urb) { 208 if (!urb) {
211 dev_err(&port->dev, "no more free urbs\n");
212 count = -ENOMEM; 209 count = -ENOMEM;
213 goto error_no_urb; 210 goto error_no_urb;
214 } 211 }
@@ -221,7 +218,6 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
221 * to transmit data to de barcode device the control endpoint is used */ 218 * to transmit data to de barcode device the control endpoint is used */
222 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); 219 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
223 if (!dr) { 220 if (!dr) {
224 dev_err(&port->dev, "out of memory\n");
225 count = -ENOMEM; 221 count = -ENOMEM;
226 goto error_no_dr; 222 goto error_no_dr;
227 } 223 }
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index a2080ac7b7e5..1dea599bb71b 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -200,8 +200,7 @@ static void setup_line(struct work_struct *work)
200 int result; 200 int result;
201 201
202 new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); 202 new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
203 if (new_setup == NULL) { 203 if (!new_setup) {
204 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
205 /* we will try again */ 204 /* we will try again */
206 schedule_delayed_work(&priv->delayed_setup_work, 205 schedule_delayed_work(&priv->delayed_setup_work,
207 msecs_to_jiffies(2)); 206 msecs_to_jiffies(2));
@@ -287,11 +286,9 @@ static void send_data(struct work_struct *work)
287 286
288 if (count != 0) { 287 if (count != 0) {
289 allow = kmalloc(1, GFP_KERNEL); 288 allow = kmalloc(1, GFP_KERNEL);
290 if (!allow) { 289 if (!allow)
291 dev_err_console(port, "%s(): kmalloc failed\n",
292 __func__);
293 return; 290 return;
294 } 291
295 result = usb_control_msg(port->serial->dev, 292 result = usb_control_msg(port->serial->dev,
296 usb_rcvctrlpipe(port->serial->dev, 0), 293 usb_rcvctrlpipe(port->serial->dev, 0),
297 OTI6858_REQ_T_CHECK_TXBUFF, 294 OTI6858_REQ_T_CHECK_TXBUFF,
@@ -517,10 +514,8 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
517 usb_clear_halt(serial->dev, port->read_urb->pipe); 514 usb_clear_halt(serial->dev, port->read_urb->pipe);
518 515
519 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); 516 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
520 if (buf == NULL) { 517 if (!buf)
521 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
522 return -ENOMEM; 518 return -ENOMEM;
523 }
524 519
525 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 520 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
526 OTI6858_REQ_T_GET_STATUS, 521 OTI6858_REQ_T_GET_STATUS,
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 9a7dfa3738d9..3dd5398174c1 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -346,7 +346,6 @@ static void pl2303_set_termios(struct tty_struct *tty,
346 346
347 buf = kzalloc(7, GFP_KERNEL); 347 buf = kzalloc(7, GFP_KERNEL);
348 if (!buf) { 348 if (!buf) {
349 dev_err(&port->dev, "%s - out of memory.\n", __func__);
350 /* Report back no change occurred */ 349 /* Report back no change occurred */
351 if (old_termios) 350 if (old_termios)
352 tty->termios = *old_termios; 351 tty->termios = *old_termios;
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index a24d59ae4032..cb51dd757b56 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -676,10 +676,8 @@ static int qt2_setup_urbs(struct usb_serial *serial)
676 676
677 serial_priv = usb_get_serial_data(serial); 677 serial_priv = usb_get_serial_data(serial);
678 serial_priv->read_urb = usb_alloc_urb(0, GFP_KERNEL); 678 serial_priv->read_urb = usb_alloc_urb(0, GFP_KERNEL);
679 if (!serial_priv->read_urb) { 679 if (!serial_priv->read_urb)
680 dev_err(&serial->dev->dev, "No free urbs available\n");
681 return -ENOMEM; 680 return -ENOMEM;
682 }
683 681
684 usb_fill_bulk_urb(serial_priv->read_urb, serial->dev, 682 usb_fill_bulk_urb(serial_priv->read_urb, serial->dev,
685 usb_rcvbulkpipe(serial->dev, 683 usb_rcvbulkpipe(serial->dev,
@@ -715,10 +713,8 @@ static int qt2_attach(struct usb_serial *serial)
715 } 713 }
716 714
717 serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); 715 serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
718 if (!serial_priv) { 716 if (!serial_priv)
719 dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
720 return -ENOMEM; 717 return -ENOMEM;
721 }
722 718
723 serial_priv->read_buffer = kmalloc(QT2_READ_BUFFER_SIZE, GFP_KERNEL); 719 serial_priv->read_buffer = kmalloc(QT2_READ_BUFFER_SIZE, GFP_KERNEL);
724 if (!serial_priv->read_buffer) { 720 if (!serial_priv->read_buffer) {
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index de958c5b52e3..a9eb6221a815 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -497,14 +497,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
497 497
498 buffer = kmalloc(writesize, GFP_ATOMIC); 498 buffer = kmalloc(writesize, GFP_ATOMIC);
499 if (!buffer) { 499 if (!buffer) {
500 dev_err(&port->dev, "out of memory\n");
501 retval = -ENOMEM; 500 retval = -ENOMEM;
502 goto error_no_buffer; 501 goto error_no_buffer;
503 } 502 }
504 503
505 urb = usb_alloc_urb(0, GFP_ATOMIC); 504 urb = usb_alloc_urb(0, GFP_ATOMIC);
506 if (!urb) { 505 if (!urb) {
507 dev_err(&port->dev, "no more free urbs\n");
508 retval = -ENOMEM; 506 retval = -ENOMEM;
509 goto error_no_urb; 507 goto error_no_urb;
510 } 508 }
@@ -736,11 +734,8 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
736 return NULL; 734 return NULL;
737 735
738 urb = usb_alloc_urb(0, mem_flags); 736 urb = usb_alloc_urb(0, mem_flags);
739 if (urb == NULL) { 737 if (!urb)
740 dev_dbg(&serial->dev->dev, "%s: alloc for endpoint %d failed\n",
741 __func__, endpoint);
742 return NULL; 738 return NULL;
743 }
744 739
745 buf = kmalloc(len, mem_flags); 740 buf = kmalloc(len, mem_flags);
746 if (buf) { 741 if (buf) {
@@ -752,9 +747,6 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
752 dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__, 747 dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__,
753 dir == USB_DIR_IN ? 'i' : 'o', urb, buf); 748 dir == USB_DIR_IN ? 'i' : 'o', urb, buf);
754 } else { 749 } else {
755 dev_dbg(&serial->dev->dev, "%s %c u:%p d:%p\n", __func__,
756 dir == USB_DIR_IN ? 'i' : 'o', urb, buf);
757
758 sierra_release_urb(urb); 750 sierra_release_urb(urb);
759 urb = NULL; 751 urb = NULL;
760 } 752 }
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 4a649edaa2c0..698dc14b7d0d 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -301,10 +301,9 @@ static int ti_startup(struct usb_serial *serial)
301 301
302 /* create device structure */ 302 /* create device structure */
303 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); 303 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
304 if (tdev == NULL) { 304 if (!tdev)
305 dev_err(&dev->dev, "%s - out of memory\n", __func__);
306 return -ENOMEM; 305 return -ENOMEM;
307 } 306
308 mutex_init(&tdev->td_open_close_lock); 307 mutex_init(&tdev->td_open_close_lock);
309 tdev->td_serial = serial; 308 tdev->td_serial = serial;
310 usb_set_serial_data(serial, tdev); 309 usb_set_serial_data(serial, tdev);
@@ -722,10 +721,8 @@ static void ti_set_termios(struct tty_struct *tty,
722 return; 721 return;
723 722
724 config = kmalloc(sizeof(*config), GFP_KERNEL); 723 config = kmalloc(sizeof(*config), GFP_KERNEL);
725 if (!config) { 724 if (!config)
726 dev_err(&port->dev, "%s - out of memory\n", __func__);
727 return; 725 return;
728 }
729 726
730 config->wFlags = 0; 727 config->wFlags = 0;
731 728
@@ -1194,10 +1191,8 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr)
1194 1191
1195 size = sizeof(struct ti_port_status); 1192 size = sizeof(struct ti_port_status);
1196 data = kmalloc(size, GFP_KERNEL); 1193 data = kmalloc(size, GFP_KERNEL);
1197 if (!data) { 1194 if (!data)
1198 dev_err(&port->dev, "%s - out of memory\n", __func__);
1199 return -ENOMEM; 1195 return -ENOMEM;
1200 }
1201 1196
1202 status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, 1197 status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS,
1203 (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); 1198 (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size);
@@ -1397,10 +1392,8 @@ static int ti_write_byte(struct usb_serial_port *port,
1397 1392
1398 size = sizeof(struct ti_write_data_bytes) + 2; 1393 size = sizeof(struct ti_write_data_bytes) + 2;
1399 data = kmalloc(size, GFP_KERNEL); 1394 data = kmalloc(size, GFP_KERNEL);
1400 if (!data) { 1395 if (!data)
1401 dev_err(&port->dev, "%s - out of memory\n", __func__);
1402 return -ENOMEM; 1396 return -ENOMEM;
1403 }
1404 1397
1405 data->bAddrType = TI_RW_DATA_ADDR_XDATA; 1398 data->bAddrType = TI_RW_DATA_ADDR_XDATA;
1406 data->bDataType = TI_RW_DATA_BYTE; 1399 data->bDataType = TI_RW_DATA_BYTE;
@@ -1516,7 +1509,6 @@ static int ti_download_firmware(struct ti_device *tdev)
1516 status = ti_do_download(dev, pipe, buffer, fw_p->size); 1509 status = ti_do_download(dev, pipe, buffer, fw_p->size);
1517 kfree(buffer); 1510 kfree(buffer);
1518 } else { 1511 } else {
1519 dev_dbg(&dev->dev, "%s ENOMEM\n", __func__);
1520 status = -ENOMEM; 1512 status = -ENOMEM;
1521 } 1513 }
1522 release_firmware(fw_p); 1514 release_firmware(fw_p);
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 85365784040b..640fe0173236 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -447,12 +447,8 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
447 struct urb *urb; 447 struct urb *urb;
448 448
449 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ 449 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
450 if (urb == NULL) { 450 if (!urb)
451 dev_dbg(&serial->interface->dev,
452 "%s: alloc for endpoint %d failed.\n", __func__,
453 endpoint);
454 return NULL; 451 return NULL;
455 }
456 452
457 /* Fill URB using supplied data. */ 453 /* Fill URB using supplied data. */
458 usb_fill_bulk_urb(urb, serial->dev, 454 usb_fill_bulk_urb(urb, serial->dev,
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index ae016439e2cd..d93878541ee7 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -324,11 +324,8 @@ static int palm_os_3_probe(struct usb_serial *serial,
324 int num_ports = 0; 324 int num_ports = 0;
325 325
326 transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL); 326 transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL);
327 if (!transfer_buffer) { 327 if (!transfer_buffer)
328 dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
329 sizeof(*connection_info));
330 return -ENOMEM; 328 return -ENOMEM;
331 }
332 329
333 /* send a get connection info request */ 330 /* send a get connection info request */
334 retval = usb_control_msg(serial->dev, 331 retval = usb_control_msg(serial->dev,
@@ -419,11 +416,8 @@ static int palm_os_4_probe(struct usb_serial *serial,
419 int retval; 416 int retval;
420 417
421 transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL); 418 transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL);
422 if (!transfer_buffer) { 419 if (!transfer_buffer)
423 dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
424 sizeof(*connection_info));
425 return -ENOMEM; 420 return -ENOMEM;
426 }
427 421
428 retval = usb_control_msg(serial->dev, 422 retval = usb_control_msg(serial->dev,
429 usb_rcvctrlpipe(serial->dev, 0), 423 usb_rcvctrlpipe(serial->dev, 0),
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index d23290e496ef..1d9d7008ad19 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -288,12 +288,8 @@ static int whiteheat_attach(struct usb_serial *serial)
288 288
289 command_info = kmalloc(sizeof(struct whiteheat_command_private), 289 command_info = kmalloc(sizeof(struct whiteheat_command_private),
290 GFP_KERNEL); 290 GFP_KERNEL);
291 if (command_info == NULL) { 291 if (!command_info)
292 dev_err(&serial->dev->dev,
293 "%s: Out of memory for port structures\n",
294 serial->type->description);
295 goto no_command_private; 292 goto no_command_private;
296 }
297 293
298 mutex_init(&command_info->mutex); 294 mutex_init(&command_info->mutex);
299 command_info->port_running = 0; 295 command_info->port_running = 0;