Skip to content

Commit b54ec29

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 5806816 commit b54ec29

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
@@ -2257,6 +2257,8 @@ static const struct ethernet_api eth_api = {
22572257
#define DEFN_DATA_QUEUE_LIST_5(n)
22582258
#endif
22592259
#define SAM_GMAC_DATA_DEFN(n) \
2260+
BUILD_ASSERT(GMAC_QUEUE_NUM >= DT_INST_PROP(n, num_queues), \
2261+
"The size of array queue_list[] is too small"); \
22602262
static struct eth_sam_dev_data eth##n##_data = { \
22612263
.mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0U}), \
22622264
.queue_list = { \

0 commit comments

Comments
 (0)