diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2024-03-24 21:12:05 -0600 |
---|---|---|
committer | Kalle Valo <kvalo@kernel.org> | 2024-03-28 15:08:06 +0200 |
commit | 5c4250092fadde9e11ac87a82b8fa4e2a5a0c767 (patch) | |
tree | f3f567d7bcd2179706acf589275240a84fbe1cf8 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | f4b09b29f8b498e6c5f7cd582b5c0cbd37c1b90a (diff) |
wifi: mwl8k: Avoid -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
ready to enable it globally.
There is currently an object (`header`), at the beginning of multiple
structures, that contains a flexible structure (`struct mwl8k_cmd_pkt`),
for example:
struct mwl8k_cmd_get_hw_spec_sta {
struct mwl8k_cmd_pkt header;
...
__le32 num_tx_desc_per_queue;
__le32 total_rxd;
} __packed;
So, in order to avoid ending up with flexible-array members in the
middle of multiple other structs, we use the `__struct_group()` helper
to separate the flexible array from the rest of the members in the
flexible structure:
struct mwl8k_cmd_pkt {
__struct_group(mwl8k_cmd_pkt_hdr, hdr, __packed,
... the rest of the members
);
char payload[];
} __packed;
With the change described above, we now declare objects of the type of
the tagged struct, in this case `struct mwl8k_cmd_pkt_hdr`, without
embedding flexible arrays in the middle of another struct:
struct mwl8k_cmd_get_hw_spec_sta {
struct mwl8k_cmd_pkt_hdr header;
...
__le32 num_tx_desc_per_queue;
__le32 total_rxd;
} __packed;
Also, update the type of a couple of variables and function parameters
from `struct mwl8k_cmd_pkt` to `struct mwl8k_cmd_pkt_hdr`.
So, with these changes, fix 33 of the following warnings[1]:
drivers/net/wireless/marvell/mwl8k.c:2353:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Link: https://gist.github.com/GustavoARSilva/7a841a92c0f24e5efdb30ce02b601eb8 [1]
Link: https://github.com/KSPP/linux/issues/202
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/ZgDrhe5pbV/WvDiZ@neat
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions