Skip to content

Commit 02ab878

Browse files
Krishna Tcarlescufi
authored andcommitted
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 <[email protected]>
1 parent ff6b526 commit 02ab878

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

subsys/net/l2/ethernet/ethernet.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ static int ethernet_send(struct net_if *iface, struct net_pkt *pkt)
732732

733733
static inline int ethernet_enable(struct net_if *iface, bool state)
734734
{
735+
int ret = 0;
735736
const struct ethernet_api *eth =
736737
net_if_get_device(iface)->api;
737738

@@ -743,15 +744,15 @@ static inline int ethernet_enable(struct net_if *iface, bool state)
743744
net_arp_clear_cache(iface);
744745

745746
if (eth->stop) {
746-
eth->stop(net_if_get_device(iface));
747+
ret = eth->stop(net_if_get_device(iface));
747748
}
748749
} else {
749750
if (eth->start) {
750-
eth->start(net_if_get_device(iface));
751+
ret = eth->start(net_if_get_device(iface));
751752
}
752753
}
753754

754-
return 0;
755+
return ret;
755756
}
756757

757758
enum net_l2_flags ethernet_flags(struct net_if *iface)

0 commit comments

Comments
 (0)