tests: stream_flash: fix hardcoded buf_len in buf_size_greater_than_page_size - #102
Merged
Merged
Conversation
RichardSWheatley
force-pushed
the
fix/stream-flash-wbs-buf-len
branch
from
June 10, 2026 22:46
f7eb496 to
e35b1f9
Compare
stream_flash_init() rejects buf_len values that are not a multiple of the device write_block_size. Using 0x10 works only when write_block_size <= 16; on hardware with larger block sizes the call returns -EFAULT and the expected- success assertion fails. Read the actual write_block_size from flash parameters and use that as buf_len instead. Fixes zephyrproject-rtos#110948 Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
RichardSWheatley
force-pushed
the
fix/stream-flash-wbs-buf-len
branch
from
June 10, 2026 23:09
e35b1f9 to
0178f4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
test_stream_flash_buf_size_greater_than_page_sizefailing on flashdevices whose
write_block_sizedoes not divide 16.stream_flash_init()returns-EFAULTwhenbuf_lenis not a multipleof the device
write_block_size(stream_flash.c:380). The hardcodedbuf_len = 0x10only satisfies this on devices withwrite_block_sizein{1, 2, 4, 8, 16}. On hardware with larger block sizes (32, 64, 512 bytes
etc.) the "expected success" assertion spuriously fails.
Replace the constant with
flash_get_parameters(fdev)->write_block_sizesothe test is portable across all flash devices.
Fixes: zephyrproject-rtos#110948
Signed-off-by: Richard Wheatley dwheat@methodical-ep.com