Skip to content

FW: fix issues exposed by codechecker - #256

Draft
Ruben-Lohberg wants to merge 20 commits into
mainfrom
255-fix-issues-exposed-by-codechecker
Draft

FW: fix issues exposed by codechecker#256
Ruben-Lohberg wants to merge 20 commits into
mainfrom
255-fix-issues-exposed-by-codechecker

Conversation

@Ruben-Lohberg

@Ruben-Lohberg Ruben-Lohberg commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Fix issues exposed by CodeChecker workflow

  • Fixed uninitialized values, invalid pointer paths, narrowing conversions, and incorrect return handling reported by CodeChecker.
  • Added validation for Bluetooth advertisement data, audio channel configuration, BMP388 FIFO reads, and GPIO interrupts.
  • Improved error logging and propagation while preserving existing behavior where possible.
  • Added safe fallbacks for audio underruns and missing codec data.

Some CodeChecker findings were intentionally silenced while preserving existing behavior instead of redesigning the underlying error handling. For example, several ignored driver return values were made explicit with (void) casts.

Possible follow-up issues:

  • Refactor battery, SD-card, MAXM86161, LED, and shutdown APIs to propagate errors currently discarded with (void).
  • Handle bmp3_init() failures and ensure FIFO pressure compensation only uses valid temperature data.
  • Validate codec channel configuration during initialization and investigate the underlying I2S alternative-buffer exhaustion.
  • Formalize device/chip-ID widths and endianness, and extract advertisement parsing into independently tested logic.

@Ruben-Lohberg Ruben-Lohberg linked an issue Jul 27, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

CodeChecker static analysis

✅ No non-style issues found.

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from 2a83a4d to fa9f7c5 Compare July 27, 2026 14:00
@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from e509194 to 5c96030 Compare July 27, 2026 14:53
@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@TobiasRoeddiger
TobiasRoeddiger marked this pull request as draft July 31, 2026 09:42
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from fc1d581 to 102bf62 Compare August 3, 2026 14:49
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from 102bf62 to 376d6e2 Compare August 3, 2026 16:04
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from 376d6e2 to 1a71b9f Compare August 3, 2026 16:10
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from 1a71b9f to afe5f09 Compare August 3, 2026 17:25
@Ruben-Lohberg Ruben-Lohberg changed the title 255 fix issues exposed by codechecker FW: fix issues exposed by codechecker Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

Include the standard and project headers that declare functions used by each translation unit. This lets Clang analyze the files independently instead of relying on transitive includes.
Document the intended loss of precision when storing sensor and parsed values in 32-bit fields. Match variadic format arguments to the unsigned integer type expected by %X while preserving the existing lower-32-bit output.
Call std::fabs for the battery-capacity difference so overload resolution is explicit and the comparison remains in floating-point arithmetic.
The connection callback returns void, so stop processing with a plain return after a parameter-update failure instead of attempting to return the error value.
Initialize the application LED state and BMP388 FIFO sample data before they are passed to downstream code. This prevents uninitialized fields from being observed on valid error and partial-frame paths.
Only adjust and consume the FIFO length after reading it successfully. This avoids updating FIFO state or issuing a read with an undefined length after an I/O failure.
Return before selecting the Earable button when the callback does not contain its pin. This prevents dereferencing an uninitialized button pointer for an unexpected interrupt mask.
Reuse the released TX buffer when no alternative buffer is available so tx_buf cannot remain null before memset().
Validate the stereo channel count before consuming both channel pointers. If encoding fails, drop the frame instead of entering the fatal error path, log once until recovery, and never send stale encoded data.
Initialize the conditionally compiled scan parameter to NULL and describe the chip-ID copy in terms of its actual alignment and aliasing constraints.
Continue through volume and mute restoration when a codec step fails, return the first error, and only persist the requested mode after all hardware operations succeed.
@Ruben-Lohberg
Ruben-Lohberg force-pushed the 255-fix-issues-exposed-by-codechecker branch from afe5f09 to dcd8df4 Compare August 3, 2026 17:35
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@Ruben-Lohberg
Ruben-Lohberg marked this pull request as ready for review August 3, 2026 17:46
@Ruben-Lohberg
Ruben-Lohberg marked this pull request as draft August 7, 2026 15:41
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.

FW: Fix issues exposed by CodeChecker

1 participant