aboutsummaryrefslogtreecommitdiff
path: root/drivers/bluetooth/btmrvl_debugfs.c
diff options
context:
space:
mode:
authorAndy Shevchenko2018-05-29 16:33:49 +0300
committerMarcel Holtmann2018-05-30 08:16:05 +0200
commitc2e7f5dee722a6f6337540b15000bed575c80793 (patch)
treeb5da6be65bd100f0fbcc1f10c1cc145ba64de07c /drivers/bluetooth/btmrvl_debugfs.c
parent3bf5e97d7bbd175248da02efca2b265d13fb6041 (diff)
Bluetooth: btmrvl: Re-use kstrtol_from_user()
Re-use kstrtol_from_user() instead of open coded variant. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btmrvl_debugfs.c')
-rw-r--r--drivers/bluetooth/btmrvl_debugfs.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c
index 023d35e3c7a7..c4867576be00 100644
--- a/drivers/bluetooth/btmrvl_debugfs.c
+++ b/drivers/bluetooth/btmrvl_debugfs.c
@@ -35,15 +35,9 @@ static ssize_t btmrvl_hscfgcmd_write(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
- char buf[16];
long result, ret;
- memset(buf, 0, sizeof(buf));
-
- if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
- return -EFAULT;
-
- ret = kstrtol(buf, 10, &result);
+ ret = kstrtol_from_user(ubuf, count, 10, &result);
if (ret)
return ret;
@@ -81,15 +75,9 @@ static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
- char buf[16];
long result, ret;
- memset(buf, 0, sizeof(buf));
-
- if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
- return -EFAULT;
-
- ret = kstrtol(buf, 10, &result);
+ ret = kstrtol_from_user(ubuf, count, 10, &result);
if (ret)
return ret;
@@ -127,15 +115,9 @@ static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
- char buf[16];
long result, ret;
- memset(buf, 0, sizeof(buf));
-
- if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
- return -EFAULT;
-
- ret = kstrtol(buf, 10, &result);
+ ret = kstrtol_from_user(ubuf, count, 10, &result);
if (ret)
return ret;