Re: [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays

From: Rosen Penev

Date: Thu Jun 18 2026 - 15:19:26 EST


On Thu Jun 18, 2026 at 2:50 AM PDT, Toke Høiland-Jørgensen wrote:
> Rosen Penev <rosenp@xxxxxxxxx> writes:
>
>> Remove the static qualifier from mutable local arrays in three EEPROM
>> power-calibration functions. These arrays are written to during normal
>> operation, so static storage is both unnecessary and misleading: it
>> implies sharing across calls when no such sharing is intended, and it
>> makes the code subtly non-reentrant. The sibling function in
>> eeprom_9287.c already uses an automatic (stack-local) pdadcValues,
>> confirming this is the correct pattern.
>>
>> This keeps ~1 KB of data off the static data section at the cost of
>> stack usage, consistent with the rest of the driver's coding style.
>
> As pointed out by the test robot, putting this much data on the stack is
> a bad idea. Pretty sure it's static for exactly this reason in the first
> place.
Sashiko points out the opposite:

This is a pre-existing issue, but by declaring vpdTableL and vpdTableR as
static local variables, doesn't this create thread-unsafe global state?
If a system contains multiple ath9k wireless adapters, or if operations
like background scans trigger ath9k_hw_reset() concurrently, threads could
race to read and write these shared arrays. Could this potentially corrupt
the EEPROM calibration data and PDADC hardware configurations across devices?
>
> -Toke