[RFC PATCH 1/1] wifi: ath12k: avoid dynamic alloc when parsing wmi tb
Nicolas Escande
nico.escande at gmail.com
Fri Feb 27 01:16:55 PST 2026
On Thu Feb 26, 2026 at 8:48 PM CET, Pablo MARTIN-GOMEZ wrote:
[...]
>> @@ -2249,6 +2250,11 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
>> if (!ab)
>> return NULL;
>>
>> + ab->wmi_tb = __alloc_percpu(WMI_TAG_MAX * sizeof(void *),
>> + __alignof__(void *));
>> + if (!ab->wmi_tb)
>> + goto err_sc_free;
> If `!ab->wmi_tb`, you're going to `free_percpu(ab->wmi_tb)`; it works but it's not super pretty.
Yes it's by design, we do not need to null check before free() and it avoids
adding a new label that would cause more code chrun
>> +
>> init_completion(&ab->driver_recovery);
>>
>> ab->workqueue = create_singlethread_workqueue("ath12k_wq");
>> @@ -2296,6 +2302,7 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
>> err_free_wq:
>> destroy_workqueue(ab->workqueue);
>> err_sc_free:
>> + free_percpu(ab->wmi_tb);
>> kfree(ab);
>> return NULL;
>> }
> [...]
>> @@ -6795,11 +6749,9 @@ ath12k_pull_pdev_temp_ev(struct ath12k_base *ab, struct sk_buff *skb,
>> ev = tb[WMI_TAG_PDEV_TEMPERATURE_EVENT];
>> if (!ev) {
>> ath12k_warn(ab, "failed to fetch pdev temp ev");
>> - kfree(tb);
>> return -EPROTO;
>> }
>>
>> - kfree(tb);
>> return 0;
>> }
> You're missing a change on `ath12k_reg_11d_new_cc_event` (was added by 591de41d7008585f2e7c35dbcf5922fcb4d79e39)
Indeed, this was ported from an older kernel, I'll fix before non RFC submission
if there is interrest from QCA around this feature.
> [...]
>
> Best regards,
> Pablo MG
More information about the ath12k
mailing list