wifi: mt76: mt7915: simplify mt7915_sys_recovery_set()

Use convenient ' kstrtou16_from_user()'
to simplify 'mt7915_sys_recovery_set()'.

Signed-off-by: Dmitry Antipov <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Dmitry Antipov
2026-07-30 10:14:20 +02:00
committed by Felix Fietkau
parent cd26ff6646
commit 540a8ed525
+3 -14
View File
@@ -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_phy *phy = file->private_data;
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
bool band = phy->mt76->band_idx; bool band = phy->mt76->band_idx;
char buf[16];
int ret = 0; int ret = 0;
u16 val; u16 val;
if (count >= sizeof(buf)) ret = kstrtou16_from_user(user_buf, count, 0, &val);
return -EINVAL; if (ret)
return ret;
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;
switch (val) { switch (val) {
/* /*