Commit 425c3326 authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Kalle Valo

wifi: mwifiex: use kstrtoX_from_user() in debugfs handlers

Use convenient 'kstrtou32_from_user()' in 'mwifiex_verext_write()'
and 'kstrtobool_from_user()' in 'mwifiex_timeshare_coex_write()',
respectively. Compile tested only.
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240110115314.421298-1-dmantipov@yandex.ru
parent bad9d211
...@@ -566,14 +566,8 @@ mwifiex_verext_write(struct file *file, const char __user *ubuf, ...@@ -566,14 +566,8 @@ mwifiex_verext_write(struct file *file, const char __user *ubuf,
int ret; int ret;
u32 versionstrsel; u32 versionstrsel;
struct mwifiex_private *priv = (void *)file->private_data; struct mwifiex_private *priv = (void *)file->private_data;
char buf[16];
memset(buf, 0, sizeof(buf)); ret = kstrtou32_from_user(ubuf, count, 10, &versionstrsel);
if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
return -EFAULT;
ret = kstrtou32(buf, 10, &versionstrsel);
if (ret) if (ret)
return ret; return ret;
...@@ -874,19 +868,14 @@ mwifiex_timeshare_coex_write(struct file *file, const char __user *ubuf, ...@@ -874,19 +868,14 @@ mwifiex_timeshare_coex_write(struct file *file, const char __user *ubuf,
{ {
bool timeshare_coex; bool timeshare_coex;
struct mwifiex_private *priv = file->private_data; struct mwifiex_private *priv = file->private_data;
char kbuf[16];
int ret; int ret;
if (priv->adapter->fw_api_ver != MWIFIEX_FW_V15) if (priv->adapter->fw_api_ver != MWIFIEX_FW_V15)
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(kbuf, 0, sizeof(kbuf)); ret = kstrtobool_from_user(ubuf, count, &timeshare_coex);
if (ret)
if (copy_from_user(&kbuf, ubuf, min_t(size_t, sizeof(kbuf) - 1, count))) return ret;
return -EFAULT;
if (kstrtobool(kbuf, &timeshare_coex))
return -EINVAL;
ret = mwifiex_send_cmd(priv, HostCmd_CMD_ROBUST_COEX, ret = mwifiex_send_cmd(priv, HostCmd_CMD_ROBUST_COEX,
HostCmd_ACT_GEN_SET, 0, &timeshare_coex, true); HostCmd_ACT_GEN_SET, 0, &timeshare_coex, true);
......
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