]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sparse: misc drivers annotations
authorAlexander Viro <viro@www.linux.org.uk>
Fri, 4 Jun 2004 00:23:33 +0000 (17:23 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 4 Jun 2004 00:23:33 +0000 (17:23 -0700)
assorted minor bits in drivers/* - all independent, but there's
some limit to splitting stuff...

drivers/char/nvram.c
drivers/char/scx200_gpio.c
drivers/char/toshiba.c
drivers/char/watchdog/pcwd.c
drivers/cpufreq/proc_intf.c
drivers/media/common/saa7146_fops.c
drivers/scsi/aha152x.c
include/asm-i386/floppy.h

index 7b6ee59edf081e89f9b3c954f9366135c7ee0207..b5f32d65e5453d37513b962699949bb307890400 100644 (file)
@@ -250,7 +250,7 @@ static loff_t nvram_llseek(struct file *file,loff_t offset, int origin )
 }
 
 static ssize_t
-nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
        unsigned char contents[NVRAM_BYTES];
        unsigned i = *ppos;
@@ -279,7 +279,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
 }
 
 static ssize_t
-nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
        unsigned char contents[NVRAM_BYTES];
        unsigned i = *ppos;
index 3758fb1b11717e0940380fb378531eee66180429..e937346e162b401d14adadce40faae9f8356ee91 100644 (file)
@@ -26,7 +26,7 @@ static int major = 0;         /* default to dynamic major */
 MODULE_PARM(major, "i");
 MODULE_PARM_DESC(major, "Major device number");
 
-static ssize_t scx200_gpio_write(struct file *file, const char *data, 
+static ssize_t scx200_gpio_write(struct file *file, const char __user *data, 
                                 size_t len, loff_t *ppos)
 {
        unsigned m = iminor(file->f_dentry->d_inode);
@@ -77,7 +77,7 @@ static ssize_t scx200_gpio_write(struct file *file, const char *data,
        return len;
 }
 
-static ssize_t scx200_gpio_read(struct file *file, char *buf,
+static ssize_t scx200_gpio_read(struct file *file, char __user *buf,
                                size_t len, loff_t *ppos)
 {
        unsigned m = iminor(file->f_dentry->d_inode);
index 15e2c72ed087856d343457208a57ca359b9558a1..5b84af027d6a65af0a4ed463788c530aa3a6fb81 100644 (file)
@@ -251,13 +251,14 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
        unsigned long arg)
 {
        SMMRegisters regs;
+       SMMRegisters __user *argp = (SMMRegisters __user *)arg;
        unsigned short ax,bx;
        int err;
 
-       if (!arg)
+       if (!argp)
                return -EINVAL;
 
-       if (copy_from_user(&regs, (SMMRegisters *) arg, sizeof(SMMRegisters)))
+       if (copy_from_user(&regs, argp, sizeof(SMMRegisters)))
                return -EFAULT;
 
        switch (cmd) {
@@ -281,7 +282,7 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
                        return -EINVAL;
        }
 
-        if (copy_to_user((SMMRegisters *) arg, &regs, sizeof(SMMRegisters)))
+        if (copy_to_user(argp, &regs, sizeof(SMMRegisters)))
                return -EFAULT;
 
        return (err==0) ? 0:-EINVAL;
index bd24b53480f4a1845049b5bff87d7a8fa2a7249e..3831614d68f421ffff960518267f501a0a2790a3 100644 (file)
@@ -404,6 +404,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
        int status;
        int temperature;
        int new_heartbeat;
+       int __user *argp = (int __user *)arg;
        static struct watchdog_info ident = {
                .options =              WDIOF_OVERHEAT |
                                        WDIOF_CARDRESET |
@@ -419,27 +420,27 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
                return -ENOIOCTLCMD;
 
        case WDIOC_GETSUPPORT:
-               if(copy_to_user((void*)arg, &ident, sizeof(ident)))
+               if(copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
                return 0;
 
        case WDIOC_GETSTATUS:
                pcwd_get_status(&status);
-               return put_user(status, (int *) arg);
+               return put_user(status, argp);
 
        case WDIOC_GETBOOTSTATUS:
-               return put_user(initial_status, (int *) arg);
+               return put_user(initial_status, argp);
 
        case WDIOC_GETTEMP:
                if (pcwd_get_temperature(&temperature))
                        return -EFAULT;
 
-               return put_user(temperature, (int *) arg);
+               return put_user(temperature, argp);
 
        case WDIOC_SETOPTIONS:
                if (revision == PCWD_REVISION_C)
                {
-                       if(copy_from_user(&rv, (int*) arg, sizeof(int)))
+                       if(copy_from_user(&rv, argp, sizeof(int)))
                                return -EFAULT;
 
                        if (rv & WDIOS_DISABLECARD)
@@ -464,7 +465,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
                return 0;
 
        case WDIOC_SETTIMEOUT:
-               if (get_user(new_heartbeat, (int *) arg))
+               if (get_user(new_heartbeat, argp))
                        return -EFAULT;
 
                if (pcwd_set_heartbeat(new_heartbeat))
@@ -474,13 +475,13 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
                /* Fall */
 
        case WDIOC_GETTIMEOUT:
-               return put_user(heartbeat, (int *)arg);
+               return put_user(heartbeat, argp);
        }
 
        return 0;
 }
 
-static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
+static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len,
                          loff_t *ppos)
 {
        /*  Can't seek (pwrite) on this device  */
@@ -541,7 +542,7 @@ static int pcwd_close(struct inode *inode, struct file *file)
  *     /dev/temperature handling
  */
 
-static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count,
+static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count,
                         loff_t *ppos)
 {
        int temperature;
index 81d58c7b74ccb197d36c068b3af65db3351fdc4d..a0eaf6f1d42497ab3e36f2877278d1294805502d 100644 (file)
@@ -164,7 +164,7 @@ end:
  */
 static int cpufreq_proc_write (
         struct file            *file,
-        const char             *buffer,
+        const char             __user *buffer,
         unsigned long          count,
         void                   *data)
 {
index 26995e2d5d4651b0ddecc68ca8e2f6e6dd484b2f..a61e91ac7951a5b4bd3773358be95a66cc53c397 100644 (file)
@@ -396,7 +396,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
        return 0;
 }
 
-static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos)
+static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
 {
        struct saa7146_fh *fh = file->private_data;
 
index 6e9d28f8fd0e99bbd8257263cc6d63543e64a643..6a5291b65ad157d5e8c3d7bb5a8f2ee88712e737 100644 (file)
@@ -577,11 +577,11 @@ struct aha152x_scdata {
 #define MSGO(i)                        (HOSTDATA(shpnt)->msgo[i])
 #define MSGO_I                 (HOSTDATA(shpnt)->msgo_i)
 #define MSGOLEN                        (HOSTDATA(shpnt)->msgo_len)
-#define ADDMSGO(x)             (MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow"))
+#define ADDMSGO(x)             (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow"))
 
 #define MSGI(i)                        (HOSTDATA(shpnt)->msgi[i])
 #define MSGILEN                        (HOSTDATA(shpnt)->msgi_len)
-#define ADDMSGI(x)             (MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow"))
+#define ADDMSGI(x)             (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow"))
 
 #define DATA_LEN               (HOSTDATA(shpnt)->data_len)
 
index 8e420add7daa1f98045a11c198a5b754ac31b6ed..f4782284807a50c20bab727d6f547109b76cf5c9 100644 (file)
@@ -204,7 +204,7 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
 {
        if((unsigned int) addr >= (unsigned int) high_memory)
-               return vfree((void *)addr);
+               vfree((void *)addr);
        else
                free_pages(addr, get_order(size));              
 }