]> oss.titaniummirror.com Git - cp210x.git/blobdiff - src/cp210x.c.karmic
Fix warnings generated by sparse tool.
[cp210x.git] / src / cp210x.c.karmic
index 60eb517bca00ae36efe994cc4fa51101e501961d..831a0f4321c49512f4402c1f132d7bda9cf99a9d 100644 (file)
@@ -300,11 +300,13 @@ static size_t copy_buf_from_user(char *kbuf, unsigned long ubuf, size_t klen)
        cp210x_buffer_t t;
 
        if (!kbuf || !ubuf || !klen ||
-                       copy_from_user(&t, (cp210x_buffer_t *)ubuf, sizeof(t)))
+                       copy_from_user(&t, (cp210x_buffer_t __user *)ubuf,
+                       sizeof(t)))
                return 0;
        if (t.len < klen)
                klen = t.len;
-       if (!t.buf || !t.len || copy_from_user(kbuf, t.buf, klen))
+       if (!t.buf || !t.len ||
+                       copy_from_user(kbuf, (char __user *)t.buf, klen))
                return 0;
        return klen;
 }
@@ -353,7 +355,7 @@ static int cp210x_reset(struct usb_serial_port *port)
         * connections are torn down.  We also ignore the error return, since
         * the part resets and doesn't send one...
         */
-       cp210x_ctlmsg(port, 0xff, 0x40, 0x0008, 0x00, 0, 0);
+       cp210x_ctlmsg(port, 0xff, 0x40, 0x0008, 0x00, NULL, 0);
 #else
        usb_reset_device(port->serial->dev);
 #endif
@@ -387,7 +389,7 @@ static inline int cp210x_setu16(struct usb_serial_port *port, int cmd,
                unsigned int value)
 {
        return cp210x_ctlmsg(port, 0xff, 0x40, 0x3700 | (cmd & 0xff),
-                       value, 0, 0);
+                       value, NULL, 0);
 }
 
 /* Populates usbstr with: (len) + (0x03) + unicode(str).  Each char in str
@@ -445,7 +447,7 @@ static int cp210x_gpioset(struct usb_serial_port *port, u8 gpio)
        dbg("%s - port %d, gpio = 0x%.2x", __FUNCTION__, port->number, gpio);
 
        return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1,
-                       ((uint16_t)gpio << 8) | GPIO_MASK, 0, 0);
+                       ((uint16_t)gpio << 8) | GPIO_MASK, NULL, 0);
 }
 
 /* Set select gpio bits */
@@ -474,7 +476,7 @@ static int cp210x_gpiosetb(struct usb_serial_port *port, u8 set, u8 clear)
        dbg("%s - port %d, gpiob = 0x%.4x", __FUNCTION__, port->number, gpio);
 
        /* FIXME: how about REQTYPE_HOST_TO_DEVICE instead of 0x40? */
-       return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1, gpio, 0, 0);
+       return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1, gpio, NULL, 0);
 }
 
 static int cp210x_gpioget(struct usb_serial_port *port, u8 *gpio)
@@ -783,7 +785,7 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case TIOCMGET:
        {
                int result = cp210x_tiocmget(tty, file);
-               if (copy_to_user(&arg, &result, sizeof(int)))
+               if (copy_to_user((int __user *)&arg, &result, sizeof(int)))
                        return -EFAULT;
                return 0;
        }
@@ -791,12 +793,11 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
 
        case TIOCMSET:
        case TIOCMBIS:
-
        case TIOCMBIC:
        {
                int val = 0;
 
-               if (copy_from_user(&val, &arg, sizeof(int)))
+               if (copy_from_user(&val, (int __user *)&arg, sizeof(int)))
                        return -EFAULT;
 
                /* this looks wrong: TIOCMSET isn't going to work right */
@@ -810,8 +811,8 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case IOCTL_GPIOGET:
        if (cp210x_get_partnum(port) == CP210x_CP2103_VERSION) {
                u8 gpio = 0;
-               if (!cp210x_gpioget(port, &gpio) && !copy_to_user((u8*)arg,
-                                       &gpio, sizeof(gpio)))
+               if (!cp210x_gpioget(port, &gpio) && !copy_to_user(
+                                       (u8 __user *)arg, &gpio, sizeof(gpio)))
                        return 0;
        }
        return -EFAULT;
@@ -841,8 +842,8 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        {
                cp210x_port_config_t config;
                if (!cp210x_portconfget(port, &config) && !copy_to_user(
-                                       (cp210x_port_config_t*)arg, &config,
-                                       sizeof(config)))
+                                       (cp210x_port_config_t __user *)arg,
+                                       &config, sizeof(config)))
                        return 0;
        }
        return -EFAULT;
@@ -851,7 +852,7 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case IOCTL_PORTCONFSET:
        {
        cp210x_port_config_t config;
-       if (!copy_from_user(&config, (cp210x_port_config_t*)arg,
+       if (!copy_from_user(&config, (cp210x_port_config_t __user *)arg,
                        sizeof(config)) &&
                        !cp210x_portconfset(port, &config))
                return 0;
@@ -862,7 +863,7 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case IOCTL_SETVID:
        {
                unsigned int vid;
-               if (!copy_from_user(&vid, (unsigned int *)arg,
+               if (!copy_from_user(&vid, (unsigned int __user *)arg,
                                sizeof(unsigned int)) &&
                                !cp210x_setu16(port, 0x01, vid))
                        return 0;
@@ -873,7 +874,7 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case IOCTL_SETPID:
        {
                unsigned int pid;
-               if (!copy_from_user(&pid, (unsigned int *)arg,
+               if (!copy_from_user(&pid, (unsigned int __user *)arg,
                                sizeof(unsigned int)) &&
                                !cp210x_setu16(port, 0x02, pid))
                        return 0;
@@ -925,7 +926,7 @@ static int cp210x_ioctl(struct tty_struct *tty, struct file *file,
        case IOCTL_SETDEVVER:
        {
                unsigned int ver;
-               if (!copy_from_user(&ver, (unsigned int *)arg,
+               if (!copy_from_user(&ver, (unsigned int __user *)arg,
                                sizeof(unsigned int)) &&
                                !cp210x_setu16(port, 0x07, ver))
                        return 0;