linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / usb / serial / kobil_sct.c
index d50dce0..b8b2131 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
@@ -46,8 +47,8 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-#include <linux/usb/serial.h>
 #include <linux/ioctl.h>
+#include "usb-serial.h"
 #include "kobil_sct.h"
 
 static int debug;
@@ -254,9 +255,11 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
        }
        
        // allocate memory for transfer buffer
-       transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
+       transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL);  
        if (! transfer_buffer) {
                return -ENOMEM;
+       } else {
+               memset(transfer_buffer, 0, transfer_buffer_length);
        }
        
        // allocate write_urb
@@ -380,10 +383,11 @@ static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs)
                
                // BEGIN DEBUG
                /*
-                 dbg_data = kzalloc((3 *  purb->actual_length + 10) * sizeof(char), GFP_KERNEL);
+                 dbg_data = (unsigned char *) kmalloc((3 *  purb->actual_length + 10) * sizeof(char), GFP_KERNEL);
                  if (! dbg_data) {
                  return;
                  }
+                 memset(dbg_data, 0, (3 *  purb->actual_length + 10));
                  for (i = 0; i < purb->actual_length; i++) { 
                  sprintf(dbg_data +3*i, "%02X ", data[i]); 
                  }
@@ -514,10 +518,11 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file)
        }
 
        // allocate memory for transfer buffer
-       transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
+       transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL);  
        if (!transfer_buffer) {
                return -ENOMEM;
        }
+       memset(transfer_buffer, 0, transfer_buffer_length);
 
        result = usb_control_msg( port->serial->dev, 
                                  usb_rcvctrlpipe(port->serial->dev, 0 ), 
@@ -559,10 +564,11 @@ static int  kobil_tiocmset(struct usb_serial_port *port, struct file *file,
        }
 
        // allocate memory for transfer buffer
-       transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
+       transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL);
        if (! transfer_buffer) {
                return -ENOMEM;
        }
+       memset(transfer_buffer, 0, transfer_buffer_length);
 
        if (set & TIOCM_RTS)
                rts = 1;
@@ -649,10 +655,11 @@ static int  kobil_ioctl(struct usb_serial_port *port, struct file *file,
                                                   (struct termios __user *)arg))
                        return -EFAULT;
                
-               settings = kzalloc(50, GFP_KERNEL);
+               settings = (unsigned char *) kmalloc(50, GFP_KERNEL);  
                if (! settings) {
                        return -ENOBUFS;
                }
+               memset(settings, 0, 50);
 
                switch (priv->internal_termios.c_cflag & CBAUD) {
                case B1200: