diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2014-05-08 14:13:17 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-23 21:39:28 +0900 |
commit | 12a7208386ac6bb114d1816ecfb6a9da3f179616 (patch) | |
tree | 3eed0619681e69c4f96d2c3dc607e41a615f1dd8 /drivers/staging/media/lirc/lirc_sir.c | |
parent | def2d8b069c3d4f388022f485b9e1823fe1fd6d9 (diff) |
staging: lirc: Fix sparse warnings
Fix sparse warnings by adding __user and __iomem annotations where
necessary and removing certain unnecessary casts. While at it,
also use u32 in place of __u32.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media/lirc/lirc_sir.c')
-rw-r--r-- | drivers/staging/media/lirc/lirc_sir.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index f781c532b3c4..e31cbb81f059 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -187,10 +187,10 @@ static bool debug; /* Communication with user-space */ static unsigned int lirc_poll(struct file *file, poll_table *wait); -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos); -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos); +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos); static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); static void add_read_queue(int flag, unsigned long val); static int init_chrdev(void); @@ -252,8 +252,8 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait) return 0; } -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos) +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) { int n = 0; int retval = 0; @@ -266,9 +266,9 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_INTERRUPTIBLE); while (n < count) { if (rx_head != rx_tail) { - if (copy_to_user((void *) buf + n, - (void *) (rx_buf + rx_head), - sizeof(int))) { + if (copy_to_user(buf + n, + rx_buf + rx_head, + sizeof(int))) { retval = -EFAULT; break; } @@ -291,8 +291,8 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_RUNNING); return n ? n : retval; } -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos) +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos) { unsigned long flags; int i, count; @@ -338,8 +338,9 @@ static ssize_t lirc_write(struct file *file, const char *buf, size_t n, static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { + u32 __user *uptr = (u32 __user *)arg; int retval = 0; - __u32 value = 0; + u32 value = 0; #ifdef LIRC_ON_SA1100 if (cmd == LIRC_GET_FEATURES) @@ -364,16 +365,16 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) case LIRC_GET_FEATURES: case LIRC_GET_SEND_MODE: case LIRC_GET_REC_MODE: - retval = put_user(value, (__u32 *) arg); + retval = put_user(value, uptr); break; case LIRC_SET_SEND_MODE: case LIRC_SET_REC_MODE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); break; #ifdef LIRC_ON_SA1100 case LIRC_SET_SEND_DUTY_CYCLE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value <= 0 || value > 100) @@ -388,7 +389,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) space_width -= LIRC_ON_SA1100_TRANSMITTER_LATENCY; break; case LIRC_SET_SEND_CARRIER: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value > 500000 || value < 20000) |