From cea168adba4875b0d436cd69daaafce9b9b24362 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Tue, 28 Jul 2026 13:31:41 -0700 Subject: [PATCH] halow: don't print version info that was never read Problem: when mmwlan_get_version() fails, mmhalow_print_version_info() logs the error and then prints `version` anyway -- an uninitialized stack struct. The reported morselib/firmware strings are whatever the stack held and the chip ID typically comes out as 0x0000, so the symptom looks like a dead SPI bus or an absent transceiver rather than a failed read. That misdirects the reader into a hardware investigation. Reproduce: 1. Make mmwlan_boot() fail, so the transceiver never boots. 2. Call mmhalow_print_version_info() (mmhalow_init() does so unconditionally). Observed: "Error occured whilst retrieving version info - 3" followed by "Morse chip ID: 0x0000" and garbage version strings. Expected: the error alone, with no fabricated values after it. Fix: return after logging the error, closing the separator line first so the block stays balanced. Verified: on hardware the spurious 0x0000 chip ID no longer appears; the failure is reported exactly once. Signed-off-by: Eric Wang --- halow/mmhalow.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/halow/mmhalow.c b/halow/mmhalow.c index e060821..96f44aa 100644 --- a/halow/mmhalow.c +++ b/halow/mmhalow.c @@ -158,6 +158,8 @@ void mmhalow_print_version_info(void) if (status != MMWLAN_SUCCESS) { ESP_LOGE(TAG, "Error occured whilst retrieving version info - %d", status); + ESP_LOGI(TAG, "-----------------------------------"); + return; } ESP_LOGI(TAG, " Morselib version: %s", version.morselib_version);