Commit f83e4e1e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by James Hogan

MIPS: Re-use kstrtobool_from_user()

Re-use kstrtobool_from_user() instead of open coded variant.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
parent f06e7aa4
...@@ -31,17 +31,10 @@ static ssize_t sc_prefetch_write(struct file *file, ...@@ -31,17 +31,10 @@ static ssize_t sc_prefetch_write(struct file *file,
const char __user *user_buf, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char buf[32];
ssize_t buf_size;
bool enabled; bool enabled;
int err; int err;
buf_size = min(count, sizeof(buf) - 1); err = kstrtobool_from_user(user_buf, count, &enabled);
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
buf[buf_size] = '\0';
err = strtobool(buf, &enabled);
if (err) if (err)
return err; return err;
......
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