[PATCH ath-next v2] wifi: ath12k: avoid dynamic alloc when parsing wmi tb
Nicolas Escande
nico.escande at gmail.com
Mon Mar 16 02:35:56 PDT 2026
On Mon Mar 16, 2026 at 3:27 AM CET, Baochen Qiang wrote:
[...]
> or alternately you can define ath12k_wmi_tb in wmi.c and add alloc/free functions in
> wmi.c, then call them in core.c. this helps modularity IMO?
I'll add new functions to wmi.c and make ath12k_wmi_tb static to that file.
>
> either way works for me!
>
[...]
>> +static int ath12k_init(void)
>> +{
>> + ath12k_wmi_tb = __alloc_percpu(WMI_TAG_MAX * sizeof(void *),
>> + __alignof__(void *));
>> + if (!ath12k_wmi_tb) {
>> + pr_warn("Failed to alloc ath12k WMI tb\n");
>
> generally we don't log memory allocation failure
sure will fix
>
>> + return -ENOMEM;
>> + }
>> +
>> + return 0;
>> +}
[...]
>> @@ -9215,11 +9127,8 @@ static void ath12k_wmi_event_teardown_complete(struct ath12k_base *ab,
>> ev = tb[WMI_TAG_MLO_TEARDOWN_COMPLETE];
>> if (!ev) {
>> ath12k_warn(ab, "failed to fetch teardown complete event\n");
>> - kfree(tb);
>> return;
>
> nit: better to remove return as well
Indeed this slipped through the cracks will fix
>
>> }
>> -
>> - kfree(tb);
>> }
>>
>> #ifdef CONFIG_ATH12K_DEBUGFS
More information about the ath12k
mailing list