From: Dmitry Antipov <dmantipov@yandex.ru>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>
Cc: linux-wireless@vger.kernel.org, Dmitry Antipov <dmantipov@yandex.ru>
Subject: [PATCH] wifi: mt76: mt7915: simplify mt7915_sys_recovery_set()
Date: Fri, 14 Aug 2026 08:43:35 +0300 [thread overview]
Message-ID: <20260814054335.1237804-1-dmantipov@yandex.ru> (raw)
Simplify 'mt7915_sys_recovery_set()' by using
the convenient 'kstrtou16_from_user()'.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
.../wireless/mediatek/mt76/mt7915/debugfs.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index 4d0854fe785b..4e9dd9f65e2f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -52,23 +52,12 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf,
struct mt7915_phy *phy = file->private_data;
struct mt7915_dev *dev = phy->dev;
bool band = phy->mt76->band_idx;
- char buf[16];
- int ret = 0;
+ int ret;
u16 val;
- if (count >= sizeof(buf))
- return -EINVAL;
-
- if (copy_from_user(buf, user_buf, count))
- return -EFAULT;
-
- if (count && buf[count - 1] == '\n')
- buf[count - 1] = '\0';
- else
- buf[count] = '\0';
-
- if (kstrtou16(buf, 0, &val))
- return -EINVAL;
+ ret = kstrtou16_from_user(user_buf, count, 0, &val);
+ if (ret)
+ return ret;
switch (val) {
/*
--
2.55.0
reply other threads:[~2026-08-14 5:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260814054335.1237804-1-dmantipov@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox