drivers: ethernet: Verify returned value from net_if_set_link_addr

This commit verifies if the mac configuration is done correctly
during liteeth setup, and prompts a warning when not.

Signed-off-by: Pawel Sagan <psagan@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
This commit is contained in:
Pawel Sagan 2021-01-07 16:12:35 +01:00 committed by Jukka Rissanen
parent 4324356a6e
commit 0ce0f63036

View file

@ -218,8 +218,11 @@ static void eth_iface_init(struct net_if *iface)
#endif
/* set MAC address */
net_if_set_link_addr(iface, context->mac_addr, sizeof(context->mac_addr),
NET_LINK_ETHERNET);
if (net_if_set_link_addr(iface, context->mac_addr, sizeof(context->mac_addr),
NET_LINK_ETHERNET) < 0) {
LOG_ERR("setting mac failed");
return;
}
/* clear pending events */
sys_write8(LITEETH_EV_TX, LITEETH_TX_EV_PENDING);