Commit 87be054a authored by Mohammed Shafi Shajakhan's avatar Mohammed Shafi Shajakhan Committed by Kalle Valo

ath10k: fix return value for btcoex and peer stats debugfs

Return value is incorrect for btcoex and peer stats debugfs
'write' entries if the user provides a value that matches with
the already available debugfs entry, this results in the debugfs
entry getting stuck and the operation has to be terminated manually.
Fix this by returning the appropriate return 'count' as we do it for
other debugfs entries like pktlog etc.

Fixes: cc61a1bb ("ath10k: enable debugfs provision to enable Peer Stats feature")
Fixes: c28e6f06 ("ath10k: fix sanity check on enabling btcoex via debugfs")
Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 4d16544d
...@@ -2122,7 +2122,7 @@ static ssize_t ath10k_write_btcoex(struct file *file, ...@@ -2122,7 +2122,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
struct ath10k *ar = file->private_data; struct ath10k *ar = file->private_data;
char buf[32]; char buf[32];
size_t buf_size; size_t buf_size;
int ret = 0; int ret;
bool val; bool val;
buf_size = min(count, (sizeof(buf) - 1)); buf_size = min(count, (sizeof(buf) - 1));
...@@ -2142,8 +2142,10 @@ static ssize_t ath10k_write_btcoex(struct file *file, ...@@ -2142,8 +2142,10 @@ static ssize_t ath10k_write_btcoex(struct file *file,
goto exit; goto exit;
} }
if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) {
ret = count;
goto exit; goto exit;
}
if (val) if (val)
set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
...@@ -2189,7 +2191,7 @@ static ssize_t ath10k_write_peer_stats(struct file *file, ...@@ -2189,7 +2191,7 @@ static ssize_t ath10k_write_peer_stats(struct file *file,
struct ath10k *ar = file->private_data; struct ath10k *ar = file->private_data;
char buf[32]; char buf[32];
size_t buf_size; size_t buf_size;
int ret = 0; int ret;
bool val; bool val;
buf_size = min(count, (sizeof(buf) - 1)); buf_size = min(count, (sizeof(buf) - 1));
...@@ -2209,8 +2211,10 @@ static ssize_t ath10k_write_peer_stats(struct file *file, ...@@ -2209,8 +2211,10 @@ static ssize_t ath10k_write_peer_stats(struct file *file,
goto exit; goto exit;
} }
if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) {
ret = count;
goto exit; goto exit;
}
if (val) if (val)
set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags);
......
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