Skip to content

test_dma_loop: Fix fail with dma_mcux_lpc #94114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

VitekST
Copy link
Contributor

@VitekST VitekST commented Aug 5, 2025

Modify the dma_mcux_lpc driver to include a sanity check when allocating channels. Release channels upon concluding the test_dma_loop test.

Fixes #91670.

The condition was instigated with the DMA driver context being added to the dma_mcux_lpc driver (with eeaf860, yes, I acknowledge that I broke this), which enables channels to be requested (allocated). The test_dma_loop test requested multiple channels (only a single one was used at a time, but they didn't get released) and as the driver was configured to hold internal state only for a limited number of channels (CONFIG_DMA_MCUX_LPC_NUMBER_OF_CHANNELS_ALLOCATED) without a sanity check when allocating it for each channel, the array holding that state structs was overrun, resulting in memory corruption and system crash.

@zephyrbot zephyrbot added platform: NXP Drivers NXP Semiconductors, drivers area: DMA Direct Memory Access labels Aug 5, 2025
VitekST added 2 commits August 5, 2025 11:06
Add a num_of_allocated_channels field to struct dma_mcux_lpc_config. Add
a a capacity check for dma_X_channel_data_arr in dma_mcux_lpc_configure.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
Release DMA channels allocated through dma_request_channel with
dma_release_channel in test_loop, test_loop_suspend_resume and
test_loop_repeated_start_stop.

This prevents channel allocation leaks and enables the tests to still
run even if the utilised DMA driver is configured to only utilise a
subset of implemented DMA channels.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
@VitekST VitekST force-pushed the bugfix/91670-dma-lpc-failed-test branch from bd2eba7 to fcda1cb Compare August 5, 2025 09:06
Copy link

sonarqubecloud bot commented Aug 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DMA Direct Memory Access platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests: tests/drivers/dma/loop_transfer: mimxrt595_evk/mimxrt595s/cm33: failed: Timeout
3 participants