wifi: mac80211: simplify airtime_flags_write()

Use 'kstrtou16_from_user()' to simplify 'airtime_flags_write()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20260727095714.347039-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Dmitry Antipov 2026-07-27 12:57:14 +03:00 committed by Johannes Berg
parent 058d979d4f
commit 7d86b0a8ac

View File

@ -171,23 +171,10 @@ static ssize_t airtime_flags_write(struct file *file,
size_t count, loff_t *ppos)
{
struct ieee80211_local *local = file->private_data;
char buf[16];
int ret;
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, &local->airtime_flags))
return -EINVAL;
return count;
ret = kstrtou16_from_user(user_buf, count, 0, &local->airtime_flags);
return ret ? : count;
}
static const struct debugfs_short_fops airtime_flags_ops = {