From 4ebcf54124c9e377a98fd2daaf0ee5bc1a2f5534 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Tue, 28 Jul 2026 13:40:11 -0700 Subject: [PATCH] halow: fail mmhalow_init() when the transceiver won't boot mmhalow_init() discarded mmwlan_boot()'s status with an explicit (void) cast, then created and started the netif and returned ESP_OK regardless. A caller was told it had a working HaLow interface when the transceiver had never booted, and the first symptom surfaced much later as unexplained traffic loss on an interface that looked healthy. Any transport-level boot failure reaches this path, and it is not quiet: mmdrv_init() has already logged "Transport init failed" by the time mmhalow_init() returns success, so the log and the return value disagree. Keep the boot status, log it, and return ESP_FAIL instead of creating a netif that cannot carry traffic. Note this is a behaviour change for callers that ignore the return value: mmhalow_init() can now fail where it previously always returned ESP_OK. Callers that already check it need no change. Signed-off-by: Eric Wang --- halow/mmhalow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/halow/mmhalow.c b/halow/mmhalow.c index e060821..af42c3e 100644 --- a/halow/mmhalow.c +++ b/halow/mmhalow.c @@ -194,7 +194,13 @@ esp_err_t mmhalow_init(const wifi_init_config_t *config) /* Boot the WLAN interface so that we can retrieve the firmware version. */ struct mmwlan_boot_args boot_args = MMWLAN_BOOT_ARGS_INIT; - (void)mmwlan_boot(&boot_args); + enum mmwlan_status boot_status = mmwlan_boot(&boot_args); + if (boot_status != MMWLAN_SUCCESS) + { + /* There is no teardown path here, so treat this as fatal for the interface. */ + ESP_LOGE(TAG, "mmwlan_boot failed - %d, transceiver is not usable", boot_status); + return ESP_FAIL; + } mmhalow_print_version_info(); #if !CONFIG_HALOW_PS_MODE mmwlan_set_power_save_mode(MMWLAN_PS_DISABLED);