Skip to content

halow: don't print version info that was never read - #3

Open
ericrwx wants to merge 1 commit into
MorseMicro:mainfrom
ericrwx:fix-uninit-version-print
Open

halow: don't print version info that was never read#3
ericrwx wants to merge 1 commit into
MorseMicro:mainfrom
ericrwx:fix-uninit-version-print

Conversation

@ericrwx

@ericrwx ericrwx commented Jul 28, 2026

Copy link
Copy Markdown

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.

Steps to 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.

Test Plan:

  • Verifiy on hardware the spurious 0x0000 chip ID no longer appears; the failure is reported exactly once.

Comment thread halow/mmhalow.c Outdated
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 <eric@rwx.one>
@ericrwx
ericrwx force-pushed the fix-uninit-version-print branch from b2ec468 to cea168a Compare July 30, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants