Commit 10c642d0 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d5147ec
...@@ -384,10 +384,8 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state) ...@@ -384,10 +384,8 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
uint8_t *break_reg; uint8_t *break_reg;
break_reg = kmalloc(2, GFP_KERNEL); break_reg = kmalloc(2, GFP_KERNEL);
if (!break_reg) { if (!break_reg)
dev_err(&port->dev, "%s - kmalloc failed\n", __func__);
return; return;
}
r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG, r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
ch341_break_reg, 0, break_reg, 2); ch341_break_reg, 0, break_reg, 2);
......
...@@ -135,7 +135,6 @@ static int usb_console_setup(struct console *co, char *options) ...@@ -135,7 +135,6 @@ static int usb_console_setup(struct console *co, char *options)
tty = kzalloc(sizeof(*tty), GFP_KERNEL); tty = kzalloc(sizeof(*tty), GFP_KERNEL);
if (!tty) { if (!tty) {
retval = -ENOMEM; retval = -ENOMEM;
dev_err(&port->dev, "no more memory\n");
goto reset_open_count; goto reset_open_count;
} }
kref_init(&tty->kref); kref_init(&tty->kref);
...@@ -144,7 +143,6 @@ static int usb_console_setup(struct console *co, char *options) ...@@ -144,7 +143,6 @@ static int usb_console_setup(struct console *co, char *options)
tty->index = co->index; tty->index = co->index;
if (tty_init_termios(tty)) { if (tty_init_termios(tty)) {
retval = -ENOMEM; retval = -ENOMEM;
dev_err(&port->dev, "no more memory\n");
goto free_tty; goto free_tty;
} }
} }
......
...@@ -305,10 +305,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, ...@@ -305,10 +305,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
length = (((size - 1) | 3) + 1) / 4; length = (((size - 1) | 3) + 1) / 4;
buf = kcalloc(length, sizeof(__le32), GFP_KERNEL); buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
if (!buf) { if (!buf)
dev_err(&port->dev, "%s - out of memory.\n", __func__);
return -ENOMEM; return -ENOMEM;
}
/* Issue the request, attempting to read 'size' bytes */ /* Issue the request, attempting to read 'size' bytes */
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 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,10 +350,8 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
length = (((size - 1) | 3) + 1) / 4; length = (((size - 1) | 3) + 1) / 4;
buf = kmalloc(length * sizeof(__le32), GFP_KERNEL); buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
if (!buf) { if (!buf)
dev_err(&port->dev, "%s - out of memory.\n", __func__);
return -ENOMEM; return -ENOMEM;
}
/* Array of integers into bytes */ /* Array of integers into bytes */
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
......
...@@ -1695,11 +1695,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) ...@@ -1695,11 +1695,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
if (!priv) { if (!priv)
dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
sizeof(struct ftdi_private));
return -ENOMEM; return -ENOMEM;
}
mutex_init(&priv->cfg_lock); mutex_init(&priv->cfg_lock);
......
...@@ -279,10 +279,9 @@ static int pkt_add(struct garmin_data *garmin_data_p, ...@@ -279,10 +279,9 @@ static int pkt_add(struct garmin_data *garmin_data_p,
if (data_length) { if (data_length) {
pkt = kmalloc(sizeof(struct garmin_packet)+data_length, pkt = kmalloc(sizeof(struct garmin_packet)+data_length,
GFP_ATOMIC); GFP_ATOMIC);
if (pkt == NULL) { if (!pkt)
dev_err(&garmin_data_p->port->dev, "out of memory\n");
return 0; return 0;
}
pkt->size = data_length; pkt->size = data_length;
memcpy(pkt->data, data, data_length); memcpy(pkt->data, data, data_length);
...@@ -1006,14 +1005,11 @@ static int garmin_write_bulk(struct usb_serial_port *port, ...@@ -1006,14 +1005,11 @@ static int garmin_write_bulk(struct usb_serial_port *port,
spin_unlock_irqrestore(&garmin_data_p->lock, flags); spin_unlock_irqrestore(&garmin_data_p->lock, flags);
buffer = kmalloc(count, GFP_ATOMIC); buffer = kmalloc(count, GFP_ATOMIC);
if (!buffer) { if (!buffer)
dev_err(&port->dev, "out of memory\n");
return -ENOMEM; return -ENOMEM;
}
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
dev_err(&port->dev, "no more free urbs\n");
kfree(buffer); kfree(buffer);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1393,10 +1389,9 @@ static int garmin_port_probe(struct usb_serial_port *port) ...@@ -1393,10 +1389,9 @@ static int garmin_port_probe(struct usb_serial_port *port)
struct garmin_data *garmin_data_p; struct garmin_data *garmin_data_p;
garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
if (garmin_data_p == NULL) { if (!garmin_data_p)
dev_err(&port->dev, "%s - Out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
init_timer(&garmin_data_p->timer); init_timer(&garmin_data_p->timer);
spin_lock_init(&garmin_data_p->lock); spin_lock_init(&garmin_data_p->lock);
INIT_LIST_HEAD(&garmin_data_p->pktlist); INIT_LIST_HEAD(&garmin_data_p->pktlist);
......
...@@ -898,7 +898,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -898,7 +898,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL);
if (!edge_port->txfifo.fifo) { if (!edge_port->txfifo.fifo) {
dev_dbg(dev, "%s - no memory\n", __func__);
edge_close(port); edge_close(port);
return -ENOMEM; return -ENOMEM;
} }
...@@ -908,7 +907,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -908,7 +907,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
edge_port->write_in_progress = false; edge_port->write_in_progress = false;
if (!edge_port->write_urb) { if (!edge_port->write_urb) {
dev_dbg(dev, "%s - no memory\n", __func__);
edge_close(port); edge_close(port);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1245,9 +1243,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, ...@@ -1245,9 +1243,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
to send out */ to send out */
count = fifo->count; count = fifo->count;
buffer = kmalloc(count+2, GFP_ATOMIC); buffer = kmalloc(count+2, GFP_ATOMIC);
if (buffer == NULL) { if (!buffer) {
dev_err_console(edge_port->port,
"%s - no more kernel memory...\n", __func__);
edge_port->write_in_progress = false; edge_port->write_in_progress = false;
goto exit_send; goto exit_send;
} }
...@@ -2025,11 +2021,8 @@ static int sram_write(struct usb_serial *serial, __u16 extAddr, __u16 addr, ...@@ -2025,11 +2021,8 @@ static int sram_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length); dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length);
transfer_buffer = kmalloc(64, GFP_KERNEL); transfer_buffer = kmalloc(64, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
__func__, 64);
return -ENOMEM; return -ENOMEM;
}
/* need to split these writes up into 64 byte chunks */ /* need to split these writes up into 64 byte chunks */
result = 0; result = 0;
...@@ -2073,11 +2066,8 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr, ...@@ -2073,11 +2066,8 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
unsigned char *transfer_buffer; unsigned char *transfer_buffer;
transfer_buffer = kmalloc(64, GFP_KERNEL); transfer_buffer = kmalloc(64, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
__func__, 64);
return -ENOMEM; return -ENOMEM;
}
/* need to split these writes up into 64 byte chunks */ /* need to split these writes up into 64 byte chunks */
result = 0; result = 0;
...@@ -2119,11 +2109,8 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr, ...@@ -2119,11 +2109,8 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr,
unsigned char *transfer_buffer; unsigned char *transfer_buffer;
transfer_buffer = kmalloc(64, GFP_KERNEL); transfer_buffer = kmalloc(64, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(&serial->dev->dev,
"%s - kmalloc(%d) failed.\n", __func__, 64);
return -ENOMEM; return -ENOMEM;
}
/* need to split these reads up into 64 byte chunks */ /* need to split these reads up into 64 byte chunks */
result = 0; result = 0;
...@@ -2163,11 +2150,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port, ...@@ -2163,11 +2150,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port,
int status = 0; int status = 0;
buffer = kmalloc(10, GFP_ATOMIC); buffer = kmalloc(10, GFP_ATOMIC);
if (!buffer) { if (!buffer)
dev_err(&edge_port->port->dev,
"%s - kmalloc(%d) failed.\n", __func__, 10);
return -ENOMEM; return -ENOMEM;
}
currentCommand = buffer; currentCommand = buffer;
...@@ -2274,10 +2258,9 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, ...@@ -2274,10 +2258,9 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port,
/* Alloc memory for the string of commands. */ /* Alloc memory for the string of commands. */
cmdBuffer = kmalloc(0x100, GFP_ATOMIC); cmdBuffer = kmalloc(0x100, GFP_ATOMIC);
if (!cmdBuffer) { if (!cmdBuffer)
dev_err(dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100);
return -ENOMEM; return -ENOMEM;
}
currCmd = cmdBuffer; currCmd = cmdBuffer;
/* Enable access to divisor latch */ /* Enable access to divisor latch */
...@@ -2783,10 +2766,9 @@ static int edge_startup(struct usb_serial *serial) ...@@ -2783,10 +2766,9 @@ static int edge_startup(struct usb_serial *serial)
/* create our private serial structure */ /* create our private serial structure */
edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
if (edge_serial == NULL) { if (!edge_serial)
dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&edge_serial->es_lock); spin_lock_init(&edge_serial->es_lock);
edge_serial->serial = serial; edge_serial->serial = serial;
usb_set_serial_data(serial, edge_serial); usb_set_serial_data(serial, edge_serial);
...@@ -2875,14 +2857,12 @@ static int edge_startup(struct usb_serial *serial) ...@@ -2875,14 +2857,12 @@ static int edge_startup(struct usb_serial *serial)
/* not set up yet, so do it now */ /* not set up yet, so do it now */
edge_serial->interrupt_read_urb = edge_serial->interrupt_read_urb =
usb_alloc_urb(0, GFP_KERNEL); usb_alloc_urb(0, GFP_KERNEL);
if (!edge_serial->interrupt_read_urb) { if (!edge_serial->interrupt_read_urb)
dev_err(ddev, "out of memory\n");
return -ENOMEM; return -ENOMEM;
}
edge_serial->interrupt_in_buffer = edge_serial->interrupt_in_buffer =
kmalloc(buffer_size, GFP_KERNEL); kmalloc(buffer_size, GFP_KERNEL);
if (!edge_serial->interrupt_in_buffer) { if (!edge_serial->interrupt_in_buffer) {
dev_err(ddev, "out of memory\n");
usb_free_urb(edge_serial->interrupt_read_urb); usb_free_urb(edge_serial->interrupt_read_urb);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2912,14 +2892,12 @@ static int edge_startup(struct usb_serial *serial) ...@@ -2912,14 +2892,12 @@ static int edge_startup(struct usb_serial *serial)
/* not set up yet, so do it now */ /* not set up yet, so do it now */
edge_serial->read_urb = edge_serial->read_urb =
usb_alloc_urb(0, GFP_KERNEL); usb_alloc_urb(0, GFP_KERNEL);
if (!edge_serial->read_urb) { if (!edge_serial->read_urb)
dev_err(ddev, "out of memory\n");
return -ENOMEM; return -ENOMEM;
}
edge_serial->bulk_in_buffer = edge_serial->bulk_in_buffer =
kmalloc(buffer_size, GFP_KERNEL); kmalloc(buffer_size, GFP_KERNEL);
if (!edge_serial->bulk_in_buffer) { if (!edge_serial->bulk_in_buffer) {
dev_err(&dev->dev, "out of memory\n");
usb_free_urb(edge_serial->read_urb); usb_free_urb(edge_serial->read_urb);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -364,11 +364,9 @@ static int write_boot_mem(struct edgeport_serial *serial, ...@@ -364,11 +364,9 @@ static int write_boot_mem(struct edgeport_serial *serial,
/* Must do a read before write */ /* Must do a read before write */
if (!serial->TiReadI2C) { if (!serial->TiReadI2C) {
temp = kmalloc(1, GFP_KERNEL); temp = kmalloc(1, GFP_KERNEL);
if (!temp) { if (!temp)
dev_err(&serial->serial->dev->dev,
"%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
status = read_boot_mem(serial, 0, 1, temp); status = read_boot_mem(serial, 0, 1, temp);
kfree(temp); kfree(temp);
if (status) if (status)
...@@ -471,10 +469,8 @@ static int tx_active(struct edgeport_port *port) ...@@ -471,10 +469,8 @@ static int tx_active(struct edgeport_port *port)
int bytes_left = 0; int bytes_left = 0;
oedb = kmalloc(sizeof(*oedb), GFP_KERNEL); oedb = kmalloc(sizeof(*oedb), GFP_KERNEL);
if (!oedb) { if (!oedb)
dev_err(&port->port->dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
lsr = kmalloc(1, GFP_KERNEL); /* Sigh, that's right, just one byte, lsr = kmalloc(1, GFP_KERNEL); /* Sigh, that's right, just one byte,
as not all platforms can do DMA as not all platforms can do DMA
...@@ -625,14 +621,11 @@ static int check_i2c_image(struct edgeport_serial *serial) ...@@ -625,14 +621,11 @@ static int check_i2c_image(struct edgeport_serial *serial)
__u16 ttype; __u16 ttype;
rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc)
dev_err(dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
buffer = kmalloc(TI_MAX_I2C_SIZE, GFP_KERNEL); buffer = kmalloc(TI_MAX_I2C_SIZE, GFP_KERNEL);
if (!buffer) { if (!buffer) {
dev_err(dev, "%s - out of memory when allocating buffer\n",
__func__);
kfree(rom_desc); kfree(rom_desc);
return -ENOMEM; return -ENOMEM;
} }
...@@ -706,10 +699,9 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) ...@@ -706,10 +699,9 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
struct device *dev = &serial->serial->dev->dev; struct device *dev = &serial->serial->dev->dev;
rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc)
dev_err(dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
rom_desc); rom_desc);
...@@ -769,10 +761,8 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev) ...@@ -769,10 +761,8 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev)
sizeof(struct ti_i2c_firmware_rec)); sizeof(struct ti_i2c_firmware_rec));
buffer = kmalloc(buffer_size, GFP_KERNEL); buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) { if (!buffer)
dev_err(dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
// Set entire image of 0xffs // Set entire image of 0xffs
memset(buffer, 0xff, buffer_size); memset(buffer, 0xff, buffer_size);
...@@ -832,10 +822,8 @@ static int i2c_type_bootmode(struct edgeport_serial *serial) ...@@ -832,10 +822,8 @@ static int i2c_type_bootmode(struct edgeport_serial *serial)
u8 *data; u8 *data;
data = kmalloc(1, GFP_KERNEL); data = kmalloc(1, GFP_KERNEL);
if (!data) { if (!data)
dev_err(dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
/* Try to read type 2 */ /* Try to read type 2 */
status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
...@@ -986,10 +974,9 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -986,10 +974,9 @@ static int download_fw(struct edgeport_serial *serial)
* Read Manufacturing Descriptor from TI Based Edgeport * Read Manufacturing Descriptor from TI Based Edgeport
*/ */
ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL); ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
if (!ti_manuf_desc) { if (!ti_manuf_desc)
dev_err(dev, "%s - out of memory.\n", __func__);
return -ENOMEM; return -ENOMEM;
}
status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
if (status) { if (status) {
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
...@@ -1006,7 +993,6 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1006,7 +993,6 @@ static int download_fw(struct edgeport_serial *serial)
rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc) {
dev_err(dev, "%s - out of memory.\n", __func__);
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1023,7 +1009,6 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1023,7 +1009,6 @@ static int download_fw(struct edgeport_serial *serial)
firmware_version = kmalloc(sizeof(*firmware_version), firmware_version = kmalloc(sizeof(*firmware_version),
GFP_KERNEL); GFP_KERNEL);
if (!firmware_version) { if (!firmware_version) {
dev_err(dev, "%s - out of memory.\n", __func__);
kfree(rom_desc); kfree(rom_desc);
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
...@@ -1068,8 +1053,6 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1068,8 +1053,6 @@ static int download_fw(struct edgeport_serial *serial)
record = kmalloc(1, GFP_KERNEL); record = kmalloc(1, GFP_KERNEL);
if (!record) { if (!record) {
dev_err(dev, "%s - out of memory.\n",
__func__);
kfree(firmware_version); kfree(firmware_version);
kfree(rom_desc); kfree(rom_desc);
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
...@@ -1153,7 +1136,6 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1153,7 +1136,6 @@ static int download_fw(struct edgeport_serial *serial)
header = kmalloc(HEADER_SIZE, GFP_KERNEL); header = kmalloc(HEADER_SIZE, GFP_KERNEL);
if (!header) { if (!header) {
dev_err(dev, "%s - out of memory.\n", __func__);
kfree(rom_desc); kfree(rom_desc);
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
...@@ -1161,7 +1143,6 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1161,7 +1143,6 @@ static int download_fw(struct edgeport_serial *serial)
vheader = kmalloc(HEADER_SIZE, GFP_KERNEL); vheader = kmalloc(HEADER_SIZE, GFP_KERNEL);
if (!vheader) { if (!vheader) {
dev_err(dev, "%s - out of memory.\n", __func__);
kfree(header); kfree(header);
kfree(rom_desc); kfree(rom_desc);
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
...@@ -1290,10 +1271,9 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1290,10 +1271,9 @@ static int download_fw(struct edgeport_serial *serial)
* Read Manufacturing Descriptor from TI Based Edgeport * Read Manufacturing Descriptor from TI Based Edgeport
*/ */
ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL); ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
if (!ti_manuf_desc) { if (!ti_manuf_desc)
dev_err(dev, "%s - out of memory.\n", __func__);
return -ENOMEM; return -ENOMEM;
}
status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
if (status) { if (status) {
kfree(ti_manuf_desc); kfree(ti_manuf_desc);
...@@ -1328,10 +1308,8 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1328,10 +1308,8 @@ static int download_fw(struct edgeport_serial *serial)
buffer_size = (((1024 * 16) - 512) + buffer_size = (((1024 * 16) - 512) +
sizeof(struct ti_i2c_image_header)); sizeof(struct ti_i2c_image_header));
buffer = kmalloc(buffer_size, GFP_KERNEL); buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) { if (!buffer)
dev_err(dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
/* Initialize the buffer to 0xff (pad the buffer) */ /* Initialize the buffer to 0xff (pad the buffer) */
memset(buffer, 0xff, buffer_size); memset(buffer, 0xff, buffer_size);
...@@ -2122,7 +2100,6 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -2122,7 +2100,6 @@ static void change_port_settings(struct tty_struct *tty,
config = kmalloc (sizeof (*config), GFP_KERNEL); config = kmalloc (sizeof (*config), GFP_KERNEL);
if (!config) { if (!config) {
tty->termios = *old_termios; tty->termios = *old_termios;
dev_err(dev, "%s - out of memory\n", __func__);
return; return;
} }
...@@ -2393,10 +2370,9 @@ static int edge_startup(struct usb_serial *serial) ...@@ -2393,10 +2370,9 @@ static int edge_startup(struct usb_serial *serial)
/* create our private serial structure */ /* create our private serial structure */
edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
if (edge_serial == NULL) { if (!edge_serial)
dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
mutex_init(&edge_serial->es_lock); mutex_init(&edge_serial->es_lock);
edge_serial->serial = serial; edge_serial->serial = serial;
usb_set_serial_data(serial, edge_serial); usb_set_serial_data(serial, edge_serial);
......
...@@ -377,15 +377,12 @@ static void ir_set_termios(struct tty_struct *tty, ...@@ -377,15 +377,12 @@ static void ir_set_termios(struct tty_struct *tty,
* send the baud change out on an "empty" data packet * send the baud change out on an "empty" data packet
*/ */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb)
dev_err(&port->dev, "%s - no more urbs\n", __func__);
return; return;
}
transfer_buffer = kmalloc(1, GFP_KERNEL); transfer_buffer = kmalloc(1, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(&port->dev, "%s - out of memory\n", __func__);
goto err_buf; goto err_buf;
}
*transfer_buffer = ir_xbof | ir_baud; *transfer_buffer = ir_xbof | ir_baud;
......
...@@ -1226,10 +1226,8 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint, ...@@ -1226,10 +1226,8 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint); dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint);
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (urb == NULL) { if (!urb)
dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d failed.\n", __func__, endpoint);
return NULL; return NULL;
}
if (endpoint == 0) { if (endpoint == 0) {
/* control EP filled in when used */ /* control EP filled in when used */
...@@ -2312,10 +2310,8 @@ static int keyspan_startup(struct usb_serial *serial) ...@@ -2312,10 +2310,8 @@ static int keyspan_startup(struct usb_serial *serial)
/* Setup private data for serial driver */ /* Setup private data for serial driver */
s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
if (!s_priv) { if (!s_priv)
dev_dbg(&serial->dev->dev, "%s - kmalloc for keyspan_serial_private failed.\n", __func__);
return -ENOMEM; return -ENOMEM;
}
s_priv->instat_buf = kzalloc(INSTAT_BUFLEN, GFP_KERNEL); s_priv->instat_buf = kzalloc(INSTAT_BUFLEN, GFP_KERNEL);
if (!s_priv->instat_buf) if (!s_priv->instat_buf)
......
...@@ -182,11 +182,9 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, ...@@ -182,11 +182,9 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
dev_info(&port->serial->dev->dev, "sending SIO Poll request\n"); dev_info(&port->serial->dev->dev, "sending SIO Poll request\n");
status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL); status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL);
if (!status_buf) { if (!status_buf)
dev_err(&port->dev, "%s - out of memory for status buffer.\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
status_buf[0] = 0xff; status_buf[0] = 0xff;
status_buf[1] = 0xff; status_buf[1] = 0xff;
rc = usb_control_msg(port->serial->dev, 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,11 +271,9 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
* priv->line_state. * priv->line_state.
*/ */
cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
if (!cfg) { if (!cfg)
dev_err(&port->dev, "%s - out of memory for config buffer.\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
cfg->pktlen = 5; cfg->pktlen = 5;
cfg->baudrate = kl5kusb105a_sio_b9600; cfg->baudrate = kl5kusb105a_sio_b9600;
cfg->databits = kl5kusb105a_dtb_8; cfg->databits = kl5kusb105a_dtb_8;
...@@ -417,10 +413,8 @@ static void klsi_105_set_termios(struct tty_struct *tty, ...@@ -417,10 +413,8 @@ static void klsi_105_set_termios(struct tty_struct *tty,
speed_t baud; speed_t baud;
cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
if (!cfg) { if (!cfg)
dev_err(dev, "%s - out of memory for config buffer.\n", __func__);
return; return;
}
/* lock while we are modifying the settings */ /* lock while we are modifying the settings */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
......
...@@ -362,15 +362,13 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, ...@@ -362,15 +362,13 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
/* create and initialize the control urb and containing urbtracker */ /* create and initialize the control urb and containing urbtracker */
urbtrack = kmalloc(sizeof(struct urbtracker), GFP_ATOMIC); urbtrack = kmalloc(sizeof(struct urbtracker), GFP_ATOMIC);
if (urbtrack == NULL) { if (!urbtrack)
dev_err(&usbdev->dev, "out of memory");
return -ENOMEM; return -ENOMEM;
}
kref_get(&mos_parport->ref_count); kref_get(&mos_parport->ref_count);
urbtrack->mos_parport = mos_parport; urbtrack->mos_parport = mos_parport;
urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC);
if (urbtrack->urb == NULL) { if (!urbtrack->urb) {
dev_err(&usbdev->dev, "out of urbs");
kfree(urbtrack); kfree(urbtrack);
return -ENOMEM; return -ENOMEM;
} }
...@@ -702,10 +700,9 @@ static int mos7715_parport_init(struct usb_serial *serial) ...@@ -702,10 +700,9 @@ static int mos7715_parport_init(struct usb_serial *serial)
/* allocate and initialize parallel port control struct */ /* allocate and initialize parallel port control struct */
mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL); mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
if (mos_parport == NULL) { if (!mos_parport)
dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
return -ENOMEM; return -ENOMEM;
}
mos_parport->msg_pending = false; mos_parport->msg_pending = false;
kref_init(&mos_parport->ref_count); kref_init(&mos_parport->ref_count);
spin_lock_init(&mos_parport->listlock); spin_lock_init(&mos_parport->listlock);
...@@ -1018,18 +1015,12 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1018,18 +1015,12 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
for (j = 0; j < NUM_URBS; ++j) { for (j = 0; j < NUM_URBS; ++j) {
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
mos7720_port->write_urb_pool[j] = urb; mos7720_port->write_urb_pool[j] = urb;
if (!urb)
if (urb == NULL) {
dev_err(&port->dev, "No more urbs???\n");
continue; continue;
}
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (!urb->transfer_buffer) { if (!urb->transfer_buffer) {
dev_err(&port->dev,
"%s-out of memory for urb buffers.\n",
__func__);
usb_free_urb(mos7720_port->write_urb_pool[j]); usb_free_urb(mos7720_port->write_urb_pool[j]);
mos7720_port->write_urb_pool[j] = NULL; mos7720_port->write_urb_pool[j] = NULL;
continue; continue;
...@@ -1250,11 +1241,8 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1250,11 +1241,8 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (urb->transfer_buffer == NULL) { if (!urb->transfer_buffer)
dev_err_console(port, "%s no more kernel memory...\n",
__func__);
goto exit; goto exit;
}
} }
transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
......
...@@ -876,20 +876,14 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -876,20 +876,14 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
for (j = 0; j < NUM_URBS; ++j) { for (j = 0; j < NUM_URBS; ++j) {
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
mos7840_port->write_urb_pool[j] = urb; mos7840_port->write_urb_pool[j] = urb;
if (!urb)
if (urb == NULL) {
dev_err(&port->dev, "No more urbs???\n");
continue; continue;
}
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (!urb->transfer_buffer) { if (!urb->transfer_buffer) {
usb_free_urb(urb); usb_free_urb(urb);
mos7840_port->write_urb_pool[j] = NULL; mos7840_port->write_urb_pool[j] = NULL;
dev_err(&port->dev,
"%s-out of memory for urb buffers.\n",
__func__);
continue; continue;
} }
} }
...@@ -1381,12 +1375,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1381,12 +1375,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = urb->transfer_buffer =
kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
if (!urb->transfer_buffer)
if (urb->transfer_buffer == NULL) {
dev_err_console(port, "%s no more kernel memory...\n",
__func__);
goto exit; goto exit;
}
} }
transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
...@@ -2206,10 +2196,8 @@ static int mos7840_port_probe(struct usb_serial_port *port) ...@@ -2206,10 +2196,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
if (mos7840_port == NULL) { if (!mos7840_port)
dev_err(&port->dev, "%s - Out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
/* Initialize all port interrupt end point to port 0 int /* Initialize all port interrupt end point to port 0 int
* endpoint. Our device has only one interrupt end point * endpoint. Our device has only one interrupt end point
......
...@@ -200,15 +200,12 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -200,15 +200,12 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
buffer = kmalloc(count, GFP_ATOMIC); buffer = kmalloc(count, GFP_ATOMIC);
if (!buffer) { if (!buffer) {
dev_err(&port->dev, "out of memory\n");
count = -ENOMEM; count = -ENOMEM;
goto error_no_buffer; goto error_no_buffer;
} }
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
dev_err(&port->dev, "no more free urbs\n");
count = -ENOMEM; count = -ENOMEM;
goto error_no_urb; goto error_no_urb;
} }
...@@ -221,7 +218,6 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -221,7 +218,6 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
* to transmit data to de barcode device the control endpoint is used */ * to transmit data to de barcode device the control endpoint is used */
dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
if (!dr) { if (!dr) {
dev_err(&port->dev, "out of memory\n");
count = -ENOMEM; count = -ENOMEM;
goto error_no_dr; goto error_no_dr;
} }
......
...@@ -200,8 +200,7 @@ static void setup_line(struct work_struct *work) ...@@ -200,8 +200,7 @@ static void setup_line(struct work_struct *work)
int result; int result;
new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
if (new_setup == NULL) { if (!new_setup) {
dev_err(&port->dev, "%s(): out of memory!\n", __func__);
/* we will try again */ /* we will try again */
schedule_delayed_work(&priv->delayed_setup_work, schedule_delayed_work(&priv->delayed_setup_work,
msecs_to_jiffies(2)); msecs_to_jiffies(2));
...@@ -287,11 +286,9 @@ static void send_data(struct work_struct *work) ...@@ -287,11 +286,9 @@ static void send_data(struct work_struct *work)
if (count != 0) { if (count != 0) {
allow = kmalloc(1, GFP_KERNEL); allow = kmalloc(1, GFP_KERNEL);
if (!allow) { if (!allow)
dev_err_console(port, "%s(): kmalloc failed\n",
__func__);
return; return;
}
result = usb_control_msg(port->serial->dev, result = usb_control_msg(port->serial->dev,
usb_rcvctrlpipe(port->serial->dev, 0), usb_rcvctrlpipe(port->serial->dev, 0),
OTI6858_REQ_T_CHECK_TXBUFF, OTI6858_REQ_T_CHECK_TXBUFF,
...@@ -517,10 +514,8 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -517,10 +514,8 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
usb_clear_halt(serial->dev, port->read_urb->pipe); usb_clear_halt(serial->dev, port->read_urb->pipe);
buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
if (buf == NULL) { if (!buf)
dev_err(&port->dev, "%s(): out of memory!\n", __func__);
return -ENOMEM; return -ENOMEM;
}
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
OTI6858_REQ_T_GET_STATUS, OTI6858_REQ_T_GET_STATUS,
......
...@@ -346,7 +346,6 @@ static void pl2303_set_termios(struct tty_struct *tty, ...@@ -346,7 +346,6 @@ static void pl2303_set_termios(struct tty_struct *tty,
buf = kzalloc(7, GFP_KERNEL); buf = kzalloc(7, GFP_KERNEL);
if (!buf) { if (!buf) {
dev_err(&port->dev, "%s - out of memory.\n", __func__);
/* Report back no change occurred */ /* Report back no change occurred */
if (old_termios) if (old_termios)
tty->termios = *old_termios; tty->termios = *old_termios;
......
...@@ -676,10 +676,8 @@ static int qt2_setup_urbs(struct usb_serial *serial) ...@@ -676,10 +676,8 @@ static int qt2_setup_urbs(struct usb_serial *serial)
serial_priv = usb_get_serial_data(serial); serial_priv = usb_get_serial_data(serial);
serial_priv->read_urb = usb_alloc_urb(0, GFP_KERNEL); serial_priv->read_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!serial_priv->read_urb) { if (!serial_priv->read_urb)
dev_err(&serial->dev->dev, "No free urbs available\n");
return -ENOMEM; return -ENOMEM;
}
usb_fill_bulk_urb(serial_priv->read_urb, serial->dev, usb_fill_bulk_urb(serial_priv->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev, usb_rcvbulkpipe(serial->dev,
...@@ -715,10 +713,8 @@ static int qt2_attach(struct usb_serial *serial) ...@@ -715,10 +713,8 @@ static int qt2_attach(struct usb_serial *serial)
} }
serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
if (!serial_priv) { if (!serial_priv)
dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
serial_priv->read_buffer = kmalloc(QT2_READ_BUFFER_SIZE, GFP_KERNEL); serial_priv->read_buffer = kmalloc(QT2_READ_BUFFER_SIZE, GFP_KERNEL);
if (!serial_priv->read_buffer) { if (!serial_priv->read_buffer) {
......
...@@ -497,14 +497,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -497,14 +497,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
buffer = kmalloc(writesize, GFP_ATOMIC); buffer = kmalloc(writesize, GFP_ATOMIC);
if (!buffer) { if (!buffer) {
dev_err(&port->dev, "out of memory\n");
retval = -ENOMEM; retval = -ENOMEM;
goto error_no_buffer; goto error_no_buffer;
} }
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
dev_err(&port->dev, "no more free urbs\n");
retval = -ENOMEM; retval = -ENOMEM;
goto error_no_urb; goto error_no_urb;
} }
...@@ -736,11 +734,8 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint, ...@@ -736,11 +734,8 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
return NULL; return NULL;
urb = usb_alloc_urb(0, mem_flags); urb = usb_alloc_urb(0, mem_flags);
if (urb == NULL) { if (!urb)
dev_dbg(&serial->dev->dev, "%s: alloc for endpoint %d failed\n",
__func__, endpoint);
return NULL; return NULL;
}
buf = kmalloc(len, mem_flags); buf = kmalloc(len, mem_flags);
if (buf) { if (buf) {
...@@ -752,9 +747,6 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint, ...@@ -752,9 +747,6 @@ static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__, dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__,
dir == USB_DIR_IN ? 'i' : 'o', urb, buf); dir == USB_DIR_IN ? 'i' : 'o', urb, buf);
} else { } else {
dev_dbg(&serial->dev->dev, "%s %c u:%p d:%p\n", __func__,
dir == USB_DIR_IN ? 'i' : 'o', urb, buf);
sierra_release_urb(urb); sierra_release_urb(urb);
urb = NULL; urb = NULL;
} }
......
...@@ -301,10 +301,9 @@ static int ti_startup(struct usb_serial *serial) ...@@ -301,10 +301,9 @@ static int ti_startup(struct usb_serial *serial)
/* create device structure */ /* create device structure */
tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
if (tdev == NULL) { if (!tdev)
dev_err(&dev->dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
mutex_init(&tdev->td_open_close_lock); mutex_init(&tdev->td_open_close_lock);
tdev->td_serial = serial; tdev->td_serial = serial;
usb_set_serial_data(serial, tdev); usb_set_serial_data(serial, tdev);
...@@ -722,10 +721,8 @@ static void ti_set_termios(struct tty_struct *tty, ...@@ -722,10 +721,8 @@ static void ti_set_termios(struct tty_struct *tty,
return; return;
config = kmalloc(sizeof(*config), GFP_KERNEL); config = kmalloc(sizeof(*config), GFP_KERNEL);
if (!config) { if (!config)
dev_err(&port->dev, "%s - out of memory\n", __func__);
return; return;
}
config->wFlags = 0; config->wFlags = 0;
...@@ -1194,10 +1191,8 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr) ...@@ -1194,10 +1191,8 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr)
size = sizeof(struct ti_port_status); size = sizeof(struct ti_port_status);
data = kmalloc(size, GFP_KERNEL); data = kmalloc(size, GFP_KERNEL);
if (!data) { if (!data)
dev_err(&port->dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS,
(__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); (__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,10 +1392,8 @@ static int ti_write_byte(struct usb_serial_port *port,
size = sizeof(struct ti_write_data_bytes) + 2; size = sizeof(struct ti_write_data_bytes) + 2;
data = kmalloc(size, GFP_KERNEL); data = kmalloc(size, GFP_KERNEL);
if (!data) { if (!data)
dev_err(&port->dev, "%s - out of memory\n", __func__);
return -ENOMEM; return -ENOMEM;
}
data->bAddrType = TI_RW_DATA_ADDR_XDATA; data->bAddrType = TI_RW_DATA_ADDR_XDATA;
data->bDataType = TI_RW_DATA_BYTE; data->bDataType = TI_RW_DATA_BYTE;
...@@ -1516,7 +1509,6 @@ static int ti_download_firmware(struct ti_device *tdev) ...@@ -1516,7 +1509,6 @@ static int ti_download_firmware(struct ti_device *tdev)
status = ti_do_download(dev, pipe, buffer, fw_p->size); status = ti_do_download(dev, pipe, buffer, fw_p->size);
kfree(buffer); kfree(buffer);
} else { } else {
dev_dbg(&dev->dev, "%s ENOMEM\n", __func__);
status = -ENOMEM; status = -ENOMEM;
} }
release_firmware(fw_p); release_firmware(fw_p);
......
...@@ -447,12 +447,8 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, ...@@ -447,12 +447,8 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
struct urb *urb; struct urb *urb;
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (urb == NULL) { if (!urb)
dev_dbg(&serial->interface->dev,
"%s: alloc for endpoint %d failed.\n", __func__,
endpoint);
return NULL; return NULL;
}
/* Fill URB using supplied data. */ /* Fill URB using supplied data. */
usb_fill_bulk_urb(urb, serial->dev, usb_fill_bulk_urb(urb, serial->dev,
......
...@@ -324,11 +324,8 @@ static int palm_os_3_probe(struct usb_serial *serial, ...@@ -324,11 +324,8 @@ static int palm_os_3_probe(struct usb_serial *serial,
int num_ports = 0; int num_ports = 0;
transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL); transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
sizeof(*connection_info));
return -ENOMEM; return -ENOMEM;
}
/* send a get connection info request */ /* send a get connection info request */
retval = usb_control_msg(serial->dev, retval = usb_control_msg(serial->dev,
...@@ -419,11 +416,8 @@ static int palm_os_4_probe(struct usb_serial *serial, ...@@ -419,11 +416,8 @@ static int palm_os_4_probe(struct usb_serial *serial,
int retval; int retval;
transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL); transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer)
dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
sizeof(*connection_info));
return -ENOMEM; return -ENOMEM;
}
retval = usb_control_msg(serial->dev, retval = usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0), usb_rcvctrlpipe(serial->dev, 0),
......
...@@ -288,12 +288,8 @@ static int whiteheat_attach(struct usb_serial *serial) ...@@ -288,12 +288,8 @@ static int whiteheat_attach(struct usb_serial *serial)
command_info = kmalloc(sizeof(struct whiteheat_command_private), command_info = kmalloc(sizeof(struct whiteheat_command_private),
GFP_KERNEL); GFP_KERNEL);
if (command_info == NULL) { if (!command_info)
dev_err(&serial->dev->dev,
"%s: Out of memory for port structures\n",
serial->type->description);
goto no_command_private; goto no_command_private;
}
mutex_init(&command_info->mutex); mutex_init(&command_info->mutex);
command_info->port_running = 0; command_info->port_running = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment