Skip to content

Commit f27d14a

Browse files
committed
drivers: net: sam_gmac: add BUILD_ASSERT for checking GMAC_QUEUE_NUM
'GMAC_QUEUE_NUM' is a value of 'num-queues' for the first GMAC instance getting from the device tree. It is used directly or indirectly (by GMAC_PRIORITY_QUEUE_NUM) for defining and initializing 'struct eth_sam_dev_data' with a value from Kconfig (GMAC_ACTIVE_PRIORITY_QUEUE_NUM). As there will be a big change for applying the corresponding num-queues for each GMAC 'struct eth_sam_dev_data', here just keep it as is. Adding the BUITD_ASSERT to make sure the array queue_list[] is large enough for all GMAC instances. Signed-off-by: Tony Han <[email protected]>
1 parent cd794c3 commit f27d14a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/ethernet/eth_sam_gmac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,8 @@ static const struct ethernet_api eth_api = {
22412241
#define DEFN_DATA_QUEUE_LIST_5(n)
22422242
#endif
22432243
#define SAM_GMAC_DATA_DEFN(n) \
2244+
BUILD_ASSERT(GMAC_QUEUE_NUM >= DT_INST_PROP(n, num_queues), \
2245+
"The size of array queue_list[] is too small"); \
22442246
static struct eth_sam_dev_data eth##n##_data = { \
22452247
.mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0U}), \
22462248
.queue_list = { \

0 commit comments

Comments
 (0)