Skip to content

[qcom-next] boot: image-fdt: Restore suppression of irrelevant ERROR message - #114

Merged
Gopinath Sekar (g-sekar) merged 3 commits into
qualcomm-linux:qcom-nextfrom
balajiselvanathan:qc/lmb-efault-fdt-suppress
Aug 14, 2026
Merged

[qcom-next] boot: image-fdt: Restore suppression of irrelevant ERROR message#114
Gopinath Sekar (g-sekar) merged 3 commits into
qualcomm-linux:qcom-nextfrom
balajiselvanathan:qc/lmb-efault-fdt-suppress

Conversation

@balajiselvanathan

Copy link
Copy Markdown

This series changes the returned error code for lmb_alloc_mem() and
lmb_free() may return to help restore suppression of the verbose ERROR
messages when FDT memreserve and reserved-memory is being processed.

Upstream link: https://lore.kernel.org/u-boot/20260811231650.3150771-1-jonas@kwiboo.se/

lmb_alloc_addr() is documented to return -EINVAL when the requested
memory region is not part of the LMB memory map. However, -EINVAL is
also used to e.g. indicate that a NULL pointer is passed as the addr
parameter or when the requested memory region partially overlaps an
existing region.

Change lmb_alloc_addr() to return -EFAULT when the requested memory
region is not part of the LMB memory map to make the type of error known
to callers. Also extend unit tests to validate that the return code has
stay the same when the requested memory region partially overlaps.

No caller of lmb_alloc_addr() is checking what type of error code is
returned, so this change has no intended behavior change.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Randolph Sapp <rs@ti.com>
Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Make lmb_free() return -EFAULT when the requested memory region is not
allocated, instead of the generic -1 error value.

Document the updated error code in the public API comment and change the
LMB unit test to check for the new -EFAULT errno value.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Randolph Sapp <rs@ti.com>
Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
The commit 623f6c5 ("boot: image-fdt: free old dtb reservations")
removed the suppression of ERROR messages when -EINVAL was returned due
to the memory region not being part of the LMB memory map.

This causes an irrelevant ERROR message during boot, e.g.:

  Model: Radxa ROCK 3B
  [...]
  ERROR: reserving fdt memory region failed (addr=10f000 size=100 flags=2): -22

or

  Model: Rockchip RK3288 Asus Tinker Board S
  [...]
  ERROR: reserving fdt memory region failed (addr=fe000000 size=1000000 flags=4): -22

FDT correctly contains reserved-memory for 10f000 or fe000000 and U-Boot
correctly does not make these regions available in the LMB memory map:

  memory[0]      [0x200000-0xefffffff], 0xefe00000 bytes, flags: none
  memory[1]      [0x100000000-0x1ffffffff], 0x100000000 bytes, flags: none

or

  memory[0]      [0x0-0x7fffffff], 0x80000000 bytes, flags: none

With lmb_alloc_mem() and lmb_free() both returning -EFAULT when the
requested memory region is not part of the LMB memory map it should be
safe to ignore these errors when FDT memreserve and reserved-memory is
being processed.

Print -EFAULT errors using a debug message to restore suppression of
this irrelevant ERROR message when memory region is not part of the LMB
memory map.

Fixes: 623f6c5 ("boot: image-fdt: free old dtb reservations")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Randolph Sapp <rs@ti.com>
Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
@g-sekar
Gopinath Sekar (g-sekar) merged commit 004bd0e into qualcomm-linux:qcom-next Aug 14, 2026
2 of 3 checks passed
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.

4 participants