lib/device_tree.c: Fix wrong check for FDT validity

Obviously one should return NULL if a FDT is not valid an not the other
way around.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I77c0e187b841e60965daac17025110181bdd32bc
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82773
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Maximilian Brune
2024-06-03 05:24:32 +02:00
parent f38c940754
commit 6466354ee9

View File

@@ -608,7 +608,7 @@ struct device_tree *fdt_unflatten(const void *blob)
const struct fdt_header *header = (const struct fdt_header *)blob; const struct fdt_header *header = (const struct fdt_header *)blob;
tree->header = header; tree->header = header;
if (fdt_is_valid(blob)) if (!fdt_is_valid(blob))
return NULL; return NULL;
uint32_t struct_offset = be32toh(header->structure_offset); uint32_t struct_offset = be32toh(header->structure_offset);