diff options
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 48 |
1 files changed, 13 insertions, 35 deletions
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) edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); if (!edge_port->txfifo.fifo) { - dev_dbg(dev, "%s - no memory\n", __func__); edge_close(port); return -ENOMEM; } @@ -908,7 +907,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) edge_port->write_in_progress = false; if (!edge_port->write_urb) { - dev_dbg(dev, "%s - no memory\n", __func__); edge_close(port); return -ENOMEM; } @@ -1245,9 +1243,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, to send out */ count = fifo->count; buffer = kmalloc(count+2, GFP_ATOMIC); - if (buffer == NULL) { - dev_err_console(edge_port->port, - "%s - no more kernel memory...\n", __func__); + if (!buffer) { edge_port->write_in_progress = false; goto exit_send; } @@ -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); transfer_buffer = kmalloc(64, GFP_KERNEL); - if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", - __func__, 64); + if (!transfer_buffer) return -ENOMEM; - } /* need to split these writes up into 64 byte chunks */ result = 0; @@ -2073,11 +2066,8 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr, unsigned char *transfer_buffer; transfer_buffer = kmalloc(64, GFP_KERNEL); - if (!transfer_buffer) { - dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", - __func__, 64); + if (!transfer_buffer) return -ENOMEM; - } /* need to split these writes up into 64 byte chunks */ result = 0; @@ -2119,11 +2109,8 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr, unsigned char *transfer_buffer; transfer_buffer = kmalloc(64, GFP_KERNEL); - if (!transfer_buffer) { - dev_err(&serial->dev->dev, - "%s - kmalloc(%d) failed.\n", __func__, 64); + if (!transfer_buffer) return -ENOMEM; - } /* need to split these reads up into 64 byte chunks */ result = 0; @@ -2163,11 +2150,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port, int status = 0; buffer = kmalloc(10, GFP_ATOMIC); - if (!buffer) { - dev_err(&edge_port->port->dev, - "%s - kmalloc(%d) failed.\n", __func__, 10); + if (!buffer) return -ENOMEM; - } currentCommand = buffer; @@ -2274,10 +2258,9 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, /* Alloc memory for the string of commands. */ cmdBuffer = kmalloc(0x100, GFP_ATOMIC); - if (!cmdBuffer) { - dev_err(dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100); + if (!cmdBuffer) return -ENOMEM; - } + currCmd = cmdBuffer; /* Enable access to divisor latch */ @@ -2783,10 +2766,9 @@ static int edge_startup(struct usb_serial *serial) /* create our private serial structure */ edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); - if (edge_serial == NULL) { - dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__); + if (!edge_serial) return -ENOMEM; - } + spin_lock_init(&edge_serial->es_lock); edge_serial->serial = serial; usb_set_serial_data(serial, edge_serial); @@ -2875,14 +2857,12 @@ static int edge_startup(struct usb_serial *serial) /* not set up yet, so do it now */ edge_serial->interrupt_read_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!edge_serial->interrupt_read_urb) { - dev_err(ddev, "out of memory\n"); + if (!edge_serial->interrupt_read_urb) return -ENOMEM; - } + edge_serial->interrupt_in_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!edge_serial->interrupt_in_buffer) { - dev_err(ddev, "out of memory\n"); usb_free_urb(edge_serial->interrupt_read_urb); return -ENOMEM; } @@ -2912,14 +2892,12 @@ static int edge_startup(struct usb_serial *serial) /* not set up yet, so do it now */ edge_serial->read_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!edge_serial->read_urb) { - dev_err(ddev, "out of memory\n"); + if (!edge_serial->read_urb) return -ENOMEM; - } + edge_serial->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!edge_serial->bulk_in_buffer) { - dev_err(&dev->dev, "out of memory\n"); usb_free_urb(edge_serial->read_urb); return -ENOMEM; } |