commonlib/device_tree.c: Fix skipping NOP tokens

The current code doesn't make much sense. The offset created by the
skipping of NOP tokens is just ignored.

Reorder the lines to skip the NOP tokens first.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I860a57e4a773b634149e84271b8322d78ac20e32
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90277
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Maximilian Brune 2025-11-30 03:23:58 +01:00 committed by Matt DeVillier
commit db01aa6cb2

View file

@ -116,11 +116,12 @@ int fdt_next_property(const void *blob, uint32_t offset,
struct fdt_property *prop)
{
struct fdt_header *header = (struct fdt_header *)blob;
uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset);
// skip NOP tokens
offset += fdt_skip_nops(blob, offset);
uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset);
int index = 0;
if (be32toh(ptr[index++]) != FDT_TOKEN_PROPERTY)
return 0;