aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath12k/wmi.c
diff options
context:
space:
mode:
authorBaochen Qiang <[email protected]>2025-04-18 02:55:38 +0000
committerJeff Johnson <[email protected]>2025-05-16 19:38:52 +0000
commit75639b743515537b6ee56bb89c857aaf8726713a (patch)
treee256adbb5a54ff5ae47ee7b75912ba0e60836c34 /drivers/net/wireless/ath/ath12k/wmi.c
parentwifi: ath12k: add support to select 6 GHz regulatory type (diff)
downloadkernel-75639b743515537b6ee56bb89c857aaf8726713a.tar.gz
kernel-75639b743515537b6ee56bb89c857aaf8726713a.zip
wifi: ath12k: move reg info handling outside
The reg info is allocated in ath12k_reg_chan_list_event() but validated in ath12k_reg_handle_chan_list(). Currently this is good since reg info would be freed regardless of validation results. However in an upcoming patch the reg info might need to be stored for later use if the result is good. Since we can not tell the result from return value of ath12k_reg_handle_chan_list(), we need to move validation out of it. Add a new helper ath12k_reg_validate_reg_info() and call it in ath12k_reg_chan_list_event(), based on the result we can choose to store or free it in the following patch. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Baochen Qiang <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
Diffstat (limited to 'drivers/net/wireless/ath/ath12k/wmi.c')
-rw-r--r--drivers/net/wireless/ath/ath12k/wmi.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index be66e88fb65a..42e275762563 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -6129,7 +6129,22 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk
ret = ath12k_pull_reg_chan_list_ext_update_ev(ab, skb, reg_info);
if (ret) {
ath12k_warn(ab, "failed to extract regulatory info from received event\n");
- goto fallback;
+ goto mem_free;
+ }
+
+ ret = ath12k_reg_validate_reg_info(ab, reg_info);
+ if (ret == ATH12K_REG_STATUS_FALLBACK) {
+ ath12k_warn(ab, "failed to validate reg info %d\n", ret);
+ /* firmware has successfully switches to new regd but host can not
+ * continue, so free reginfo and fallback to old regd
+ */
+ goto mem_free;
+ } else if (ret == ATH12K_REG_STATUS_DROP) {
+ /* reg info is valid but we will not store it and
+ * not going to create new regd for it
+ */
+ ret = ATH12K_REG_STATUS_VALID;
+ goto mem_free;
}
ret = ath12k_reg_handle_chan_list(ab, reg_info, WMI_VDEV_TYPE_UNSPEC,
@@ -6139,7 +6154,14 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk
goto fallback;
}
- goto mem_free;
+ goto out;
+
+mem_free:
+ ath12k_reg_reset_reg_info(reg_info);
+ kfree(reg_info);
+
+ if (ret == ATH12K_REG_STATUS_VALID)
+ return ret;
fallback:
/* Fallback to older reg (by sending previous country setting
@@ -6152,12 +6174,7 @@ fallback:
/* TODO: This is rare, but still should also be handled */
WARN_ON(1);
-mem_free:
- if (reg_info) {
- ath12k_reg_reset_reg_info(reg_info);
- kfree(reg_info);
- }
-
+out:
return ret;
}