Skip to contentSkip to conversation

MIPS: Re-use kstrtobool_from_user()

PATCH New Andy Shevchenko 1 participant 1 message May 3, 2018 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Re-use kstrtobool_from_user()

Re-use kstrtobool_from_user() instead of open coded variant.

---
 arch/mips/mm/sc-debugfs.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/mips/mm/sc-debugfs.c +1 -8
index 2e2132d3f5c7..2a116084216f 100644
@@ -31,17 +31,10 @@ static ssize_t sc_prefetch_write(struct file *file,
 				 const char __user *user_buf,
 				 size_t count, loff_t *ppos)
 {
-	char buf[32];
-	ssize_t buf_size;
 	bool enabled;
 	int err;
 
-	buf_size = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, buf_size))
-		return -EFAULT;
-
-	buf[buf_size] = '\0';
-	err = strtobool(buf, &enabled);
+	err = kstrtobool_from_user(user_buf, count, &enabled);
 	if (err)
 		return err;
 
Signature · 1 line
2.17.0