Skip to content

Commit 334c0aa

Browse files
Archcadyadbridge
authored andcommitted
A better approach to flip "netif_inited"
1 parent a9b1b1c commit 334c0aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

features/FEATURE_LWIP/lwip-interface/lwip_stack.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ nsapi_error_t mbed_lwip_emac_init(emac_interface_t *emac)
467467
eth_arch_enable_interrupts();
468468
#endif
469469

470-
netif_inited = true;
471470
return NSAPI_ERROR_OK;
472471
#else
473472
return NSAPI_ERROR_UNSUPPORTED;
@@ -477,8 +476,13 @@ nsapi_error_t mbed_lwip_emac_init(emac_interface_t *emac)
477476
// Backwards compatibility with people using DEVICE_EMAC
478477
nsapi_error_t mbed_lwip_init(emac_interface_t *emac)
479478
{
479+
nsapi_error_t ret;
480480
mbed_lwip_core_init();
481-
return mbed_lwip_emac_init(emac);
481+
ret = mbed_lwip_emac_init(emac);
482+
if (ret == NSAPI_ERROR_OK) {
483+
netif_inited = true;
484+
}
485+
return ret;
482486
}
483487

484488
// Backwards compatibility with people using DEVICE_EMAC

0 commit comments

Comments
 (0)