aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7720.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
-rw-r--r--drivers/usb/serial/mos7720.c26
1 files changed, 7 insertions, 19 deletions
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