On 4/17/2024 1:17 AM, Su Hui wrote:Yes, this is my fault. I will remove this in v2 patch.
u8 peer_debug_trigger;this is unnecessary since this will be written in all paths that lead to the
- int ret;
+ int ret = 0;
return that reads it
if (kstrtou8_from_user(user_buf, count, 0, &peer_debug_trigger))I'd suggest as an alternate solution that this function is a good candidate
return -EINVAL;
@@ -432,14 +432,12 @@ ath10k_dbg_sta_write_peer_debug_trigger(struct file *file,
ret = ath10k_wmi_peer_set_param(ar, arsta->arvif->vdev_id, sta->addr,
ar->wmi.peer_param->debug, peer_debug_trigger);
- if (ret) {
+ if (ret)
ath10k_warn(ar, "failed to set param to trigger peer tid logs for station ret: %d\n",
ret);
- goto out;
- }
out:
mutex_unlock(&ar->conf_mutex);
- return count;
+ return ret ?: count;
}
static const struct file_operations fops_peer_debug_trigger = {
for the the cleanup.h functionality. By scoping the mutex_lock() you can
simply return at each error location, and remove the explicit mutex_unlock().
But I'd accept this with the initializer change removed as well since I don't
think ath10k has any cleanup.h usages yet.