[PATCH ath-next v3] wifi: ath12k: avoid dynamic alloc when parsing wmi tb

Nicolas Escande nico.escande at gmail.com
Mon Mar 16 03:57:00 PDT 2026


On Mon Mar 16, 2026 at 11:42 AM CET, Baochen Qiang wrote:
[...]
>> --- a/drivers/net/wireless/ath/ath12k/core.c
>> +++ b/drivers/net/wireless/ath/ath12k/core.c
>> @@ -2321,5 +2321,24 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
>>  	return NULL;
>>  }
>>  
>> +static int ath12k_init(void)
>> +{
>> +	int ret;
>> +
>> +	ret = ath12k_wmi_alloc();
>> +	if (ret)
>> +		return ret;
>> +
>> +	return 0;
>
> nit: you can simply
>
> 	return ath12k_wmi_alloc();

Yes we can, but I did this in case we need to add more stuff in that function at
some later point. It would generate less code chrun. But I'm ok with a direct
return statement if you think that's better. Just tell me and I'll send the v4.

>
>> +}
>> +
>> +static void ath12k_exit(void)
>> +{
>> +	ath12k_wmi_free();
>> +}
>> +
>> +module_init(ath12k_init);
>> +module_exit(ath12k_exit);
>> +
>>  MODULE_DESCRIPTION("Driver support for Qualcomm Technologies WLAN devices");
>>  MODULE_LICENSE("Dual BSD/GPL");
>> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
>> index 59c193b24764..02ee6c718621 100644
>> --- a/drivers/net/wireless/ath/ath12k/core.h
>> +++ b/drivers/net/wireless/ath/ath12k/core.h
>> @@ -19,6 +19,7 @@
>>  #include <linux/average.h>
>>  #include <linux/of.h>
>>  #include <linux/rhashtable.h>
>> +#include <linux/percpu.h>
>
> does it make more sense to add this to wmi.c instead?

Indeed it does. I'll fix it.



More information about the ath12k mailing list