Commit ed62f77b authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

cris: use simple_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d50004b0
...@@ -35,19 +35,16 @@ read_cris_profile(struct file *file, char __user *buf, ...@@ -35,19 +35,16 @@ read_cris_profile(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
unsigned long p = *ppos; unsigned long p = *ppos;
ssize_t ret;
if (p > SAMPLE_BUFFER_SIZE) ret = simple_read_from_buffer(buf, count, ppos, sample_buffer,
return 0; SAMPLE_BUFFER_SIZE);
if (ret < 0)
return ret;
if (p + count > SAMPLE_BUFFER_SIZE) memset(sample_buffer + p, 0, ret);
count = SAMPLE_BUFFER_SIZE - p;
if (copy_to_user(buf, sample_buffer + p,count))
return -EFAULT;
memset(sample_buffer + p, 0, count); return ret;
*ppos += count;
return count;
} }
static ssize_t static ssize_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment