summaryrefslogtreecommitdiff
path: root/drivers/edac/cell_edac.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2024-08-15 12:36:33 -0600
committerFelix Fietkau <nbd@nbd.name>2024-09-06 14:23:07 +0200
commitbb6fe2b92ae7bab4d95976a1a4d705d40731f690 (patch)
tree1dca2c928afe69cf0795e99bcce47ce90aeede6d /drivers/edac/cell_edac.c
parent1ccc9e476ce76e8577ba4fdbd1f63cb3e3499d38 (diff)
wifi: mt76: Avoid multiple -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. So, in order to avoid ending up with a flexible-array member in the middle of multiple other structs, we use the `struct_group_tagged()` helper to create a new tagged `struct mt76_connac2_mcu_rxd_hdr`. This structure groups together all the members of the flexible `struct mt76_connac2_mcu_rxd` except the flexible array. As a result, the array is effectively separated from the rest of the members without modifying the memory layout of the flexible structure. We then change the type of the middle struct members currently causing trouble from `struct mt76_connac2_mcu_rxd` to `struct mt76_connac2_mcu_rxd_hdr`. We also want to ensure that when new members need to be added to the flexible structure, they are always included within the newly created tagged struct. For this, we use `static_assert()`. This ensures that the memory layout for both the flexible structure and the new tagged struct is the same after any changes. This approach avoids having to implement `struct mt76_connac2_mcu_rxd_hdr` as a completely separate structure, thus preventing having to maintain two independent but basically identical structures, closing the door to potential bugs in the future. So, with these changes, fix the following warnings: drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:32:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:40:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:49:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:58:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://patch.msgid.link/Zr5KsZugaEXrApQJ@elsanto Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/edac/cell_edac.c')
0 files changed, 0 insertions, 0 deletions