Skip to content

Commit b77ecb3

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 0f2d94d commit b77ecb3

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
@@ -2225,6 +2225,8 @@ static const struct ethernet_api eth_api = {
22252225
#define DEFN_DATA_QUEUE_LIST_5(n)
22262226
#endif
22272227
#define SAM_GMAC_DATA_DEFN(n) \
2228+
BUILD_ASSERT(GMAC_QUEUE_NUM >= DT_INST_PROP(n, num_queues), \
2229+
"The size of array queue_list[] is too small"); \
22282230
static struct eth_sam_dev_data eth##n##_data = { \
22292231
.mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0U}), \
22302232
.queue_list = { \

0 commit comments

Comments
 (0)