Netif: add allowance for init to override netif->num

Adjusts assert logic from 9c80a66253
to allow for a netif driver's init callback to manually override
the number.  When the init function is taking care of the unique
assignment, the assert simply checks that a valid number was provided
This commit is contained in:
Joel Cunningham 2017-01-20 14:49:11 -06:00
parent edac92d03a
commit e158f87286

View File

@ -300,7 +300,6 @@ netif_add(struct netif *netif,
/* remember netif specific state information data */
netif->state = state;
netif->num = netif_num++;
LWIP_ASSERT("Netif num overflow, too many netifs or adds/removes", netif->num < 255);
netif->input = input;
NETIF_SET_HWADDRHINT(netif, NULL);
@ -317,6 +316,11 @@ netif_add(struct netif *netif,
return NULL;
}
/* check that netif_num has not overflowed or that init callback
provided a valid number (we don't support 255 since that can't be
converted to an index) */
LWIP_ASSERT("Netif num overflow/invalid num", netif->num < 255);
/* add this netif to the list */
netif->next = netif_list;
netif_list = netif;