Skip to content

fix(teensy4): guard FlexIO and LPUART show paths against busy/OOM/timeout bugs - #5498

Merged
zackees merged 1 commit into
masterfrom
fix/teensy4-flexio-lpuart-show-timeout
Dec 3, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/teensy4-flexio-lpuart-show-timeout

Conversation

@zackees

@zackees zackees commented Dec 3, 2026

Copy link
Copy Markdown
Member

Fixes item #10 from #5492.

Summary

  • Teensy 4 FlexIO (channel_engine_flexio.cpp.hpp):
    • Guard show() with waitForReady() before starting transmission; if still busy on timeout, release pending channels cleanly instead of leaving stale isInUse() flags or corrupting in-flight state.
    • Bound busy-wait loops and handle mScratchBuffer.resize() OOM cleanly (dropping the frame and releasing isInUse()).
    • Mark all enqueued channels in use across multi-channel batches and release cleanly on error/completion.
  • Teensy 4 LPUART (channel_engine_lpuart.cpp.hpp):
    • Release enqueued channels when peripheral is null or instance creation fails.
    • Verify getTxBuffer() / getTxBufferSize() capacity before encoding/calling show(), dropping undersized frames instead of writing past the TX buffer.

Verification

  • bash lint passed on all 4 modified files.
  • bash test channel_engine_flexio --debug passed (ASAN/LSAN/UBSAN).
  • bash test ilpuart_peripheral --debug passed (ASAN/LSAN/UBSAN).

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b40e282 and 627e328.

Files selected for processing: 4

  • src/platforms/arm/teensy/teensy4_common/drivers/flexio/channel_engine_flexio.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/drivers/lpuart/channel_engine_lpuart.cpp.hpp
  • tests/unit/platforms/arm/teensy/teensy4_common/drivers/flexio/channel_engine_flexio.cpp
  • tests/unit/platforms/arm/teensy/teensy4_common/drivers/lpuart/ilpuart_peripheral.cpp

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Memory usage (this PR vs. its merge base)

Change in examples/Blink per target. The left number is this PR's image flash / attributed RAM in bytes; the colored delta is the change from the merge base (red ↑ is larger, green ↓ is smaller, Same is unchanged).

Target FLASH [bytes] RAM [bytes]
attiny85 2,460 (Same) 136 (Same)
teensy41 46,080 (Same) 21,738 (Same)

@zackees
zackees added this pull request to the merge queue Dec 3, 2026
Merged via the queue into master with commit ee6896a Dec 3, 2026
133 checks passed
@zackees
zackees deleted the fix/teensy4-flexio-lpuart-show-timeout branch December 3, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant