From 02ab878704c4739fee7d433415732fb516c6e56f Mon Sep 17 00:00:00 2001 From: Krishna T Date: Thu, 12 Jan 2023 01:42:28 +0530 Subject: [PATCH] net: ethernet: Check return value for start/stop The L2 networking layer checks for return value from enable, but Ethernet is not checking and always returns 0, so, relay the return value from the Ethernet driver to networking stack. This fixes the issue of interface start failing but interface still being up. Signed-off-by: Krishna T --- subsys/net/l2/ethernet/ethernet.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/net/l2/ethernet/ethernet.c b/subsys/net/l2/ethernet/ethernet.c index f5cd3bf0fd1..568611404bb 100644 --- a/subsys/net/l2/ethernet/ethernet.c +++ b/subsys/net/l2/ethernet/ethernet.c @@ -732,6 +732,7 @@ error: static inline int ethernet_enable(struct net_if *iface, bool state) { + int ret = 0; const struct ethernet_api *eth = net_if_get_device(iface)->api; @@ -743,15 +744,15 @@ static inline int ethernet_enable(struct net_if *iface, bool state) net_arp_clear_cache(iface); if (eth->stop) { - eth->stop(net_if_get_device(iface)); + ret = eth->stop(net_if_get_device(iface)); } } else { if (eth->start) { - eth->start(net_if_get_device(iface)); + ret = eth->start(net_if_get_device(iface)); } } - return 0; + return ret; } enum net_l2_flags ethernet_flags(struct net_if *iface)