Skip to contentSkip to conversation

net: lwip: simplify net_lwip_eth_start

PATCH In review Tim Harvey 2 participants 2 messages Jul 10, 2025 Networking

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 net: lwip: simplify net_lwip_eth_start

For NET_LWIP eth_is_on_demand_init() is always 1 so remove the check and simplify the code.

---
 net/lwip/net-lwip.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
net/lwip/net-lwip.c +5 -9
index d53faa39ba11..660ceb10cbe2 100644
@@ -184,16 +184,12 @@ int net_lwip_eth_start(void)
 	int ret;
 
 	net_init();
-	if (eth_is_on_demand_init()) {
+	eth_halt();
+	eth_set_current();
+	ret = eth_init();
+	if (ret < 0) {
 		eth_halt();
-		eth_set_current();
-		ret = eth_init();
-		if (ret < 0) {
-			eth_halt();
-			return ret;
-		}
-	} else {
-		eth_init_state_only();
+		return ret;
 	}
 
 	return 0;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Tim Harvey

For NET_LWIP eth_is_on_demand_init() is always 1 so remove the check and simplify the code.

---
 net/lwip/net-lwip.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
net/lwip/net-lwip.c +4 -3
index d53faa39ba11..660ceb10cbe2 100644
@@ -184,16 +184,12 @@ int net_lwip_eth_start(void)
 	int ret;
 
 	net_init();
-	if (eth_is_on_demand_init()) {
+	eth_halt();
+	eth_set_current();
+	ret = eth_init();
+	if (ret < 0) {
 		eth_halt();
-		eth_set_current();
-		ret = eth_init();

net/lwip/net-lwip.c int net_lwip_eth_start(void) · line 195

Quoted 10 lines
net/lwip/net-lwip.c +1 -6
-		if (ret < 0) {
-			eth_halt();
-			return ret;
-		}
-	} else {
-		eth_init_state_only();
+		return ret;
 	}
 
 	return 0;

Thanks,

Signature · 1 line
Jerome