From e7c0f42a2e29cfc87cb22ed6f213c77172d95f42 Mon Sep 17 00:00:00 2001 From: Juan Pablo Conde Date: Thu, 22 Jun 2023 16:33:15 -0500 Subject: [PATCH] refactor(fdt-wrappers): fix for unit testing errors As the unit testing project uses the host machine GCC version to compile, it is marking non-casted references as errors. This patch adds the proper casting, so it compiles correctly for both Arm platforms and host machines for unit testing. Change-Id: Iee96e9117301ba28b6f164aac2cd36dc0f8b6be8 Signed-off-by: Juan Pablo Conde --- include/common/fdt_wrappers.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/common/fdt_wrappers.h b/include/common/fdt_wrappers.h index b16510f3d..abbf9764b 100644 --- a/include/common/fdt_wrappers.h +++ b/include/common/fdt_wrappers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2022, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -49,7 +49,7 @@ int fdtw_find_or_add_subnode(void *fdt, int parentoffset, const char *name); static inline uint32_t fdt_blob_size(const void *dtb) { - const uint32_t *dtb_header = dtb; + const uint32_t *dtb_header = (const uint32_t *)dtb; return fdt32_to_cpu(dtb_header[1]); } @@ -60,7 +60,8 @@ static inline bool fdt_node_is_enabled(const void *fdt, int node) const void *prop = fdt_getprop(fdt, node, "status", &len); /* A non-existing status property means the device is enabled. */ - return (prop == NULL) || (len == 5 && strcmp(prop, "okay") == 0); + return (prop == NULL) || (len == 5 && strcmp((const char *)prop, + "okay") == 0); } #define fdt_for_each_compatible_node(dtb, node, compatible_str) \