mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 05:16:57 +00:00
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:
committed by
Felix Fietkau
parent
cd26ff6646
commit
540a8ed525
+3
-14
@@ -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;
|
||||
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) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user