Skip to content

Commit b1ca77b

Browse files
committed
A better approach to flip "netif_inited"
1 parent a812696 commit b1ca77b

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
@@ -469,7 +469,6 @@ nsapi_error_t mbed_lwip_emac_init(emac_interface_t *emac)
469469
eth_arch_enable_interrupts();
470470
#endif
471471

472-
netif_inited = true;
473472
return NSAPI_ERROR_OK;
474473
#else
475474
return NSAPI_ERROR_UNSUPPORTED;
@@ -479,8 +478,13 @@ nsapi_error_t mbed_lwip_emac_init(emac_interface_t *emac)
479478
// Backwards compatibility with people using DEVICE_EMAC
480479
nsapi_error_t mbed_lwip_init(emac_interface_t *emac)
481480
{
481+
nsapi_error_t ret;
482482
mbed_lwip_core_init();
483-
return mbed_lwip_emac_init(emac);
483+
ret = mbed_lwip_emac_init(emac);
484+
if (ret == NSAPI_ERROR_OK) {
485+
netif_inited = true;
486+
}
487+
return ret;
484488
}
485489

486490
// Backwards compatibility with people using DEVICE_EMAC

0 commit comments

Comments
 (0)