aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/kobil_sct.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/kobil_sct.c')
-rw-r--r--drivers/usb/serial/kobil_sct.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index b8b213185d0f..87dfcd89ffab 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -255,11 +255,9 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
255 } 255 }
256 256
257 // allocate memory for transfer buffer 257 // allocate memory for transfer buffer
258 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 258 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
259 if (! transfer_buffer) { 259 if (! transfer_buffer) {
260 return -ENOMEM; 260 return -ENOMEM;
261 } else {
262 memset(transfer_buffer, 0, transfer_buffer_length);
263 } 261 }
264 262
265 // allocate write_urb 263 // allocate write_urb
@@ -383,11 +381,10 @@ static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs)
383 381
384 // BEGIN DEBUG 382 // BEGIN DEBUG
385 /* 383 /*
386 dbg_data = (unsigned char *) kmalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL); 384 dbg_data = kzalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL);
387 if (! dbg_data) { 385 if (! dbg_data) {
388 return; 386 return;
389 } 387 }
390 memset(dbg_data, 0, (3 * purb->actual_length + 10));
391 for (i = 0; i < purb->actual_length; i++) { 388 for (i = 0; i < purb->actual_length; i++) {
392 sprintf(dbg_data +3*i, "%02X ", data[i]); 389 sprintf(dbg_data +3*i, "%02X ", data[i]);
393 } 390 }
@@ -518,11 +515,10 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file)
518 } 515 }
519 516
520 // allocate memory for transfer buffer 517 // allocate memory for transfer buffer
521 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 518 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
522 if (!transfer_buffer) { 519 if (!transfer_buffer) {
523 return -ENOMEM; 520 return -ENOMEM;
524 } 521 }
525 memset(transfer_buffer, 0, transfer_buffer_length);
526 522
527 result = usb_control_msg( port->serial->dev, 523 result = usb_control_msg( port->serial->dev,
528 usb_rcvctrlpipe(port->serial->dev, 0 ), 524 usb_rcvctrlpipe(port->serial->dev, 0 ),
@@ -564,11 +560,10 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
564 } 560 }
565 561
566 // allocate memory for transfer buffer 562 // allocate memory for transfer buffer
567 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 563 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
568 if (! transfer_buffer) { 564 if (! transfer_buffer) {
569 return -ENOMEM; 565 return -ENOMEM;
570 } 566 }
571 memset(transfer_buffer, 0, transfer_buffer_length);
572 567
573 if (set & TIOCM_RTS) 568 if (set & TIOCM_RTS)
574 rts = 1; 569 rts = 1;
@@ -655,11 +650,10 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
655 (struct termios __user *)arg)) 650 (struct termios __user *)arg))
656 return -EFAULT; 651 return -EFAULT;
657 652
658 settings = (unsigned char *) kmalloc(50, GFP_KERNEL); 653 settings = kzalloc(50, GFP_KERNEL);
659 if (! settings) { 654 if (! settings) {
660 return -ENOBUFS; 655 return -ENOBUFS;
661 } 656 }
662 memset(settings, 0, 50);
663 657
664 switch (priv->internal_termios.c_cflag & CBAUD) { 658 switch (priv->internal_termios.c_cflag & CBAUD) {
665 case B1200: 659 case B1200: