[rtems commit] libfdt: fdt_grab_space_(): Fix comparison warning

Sebastian Huber sebh at rtems.org
Thu Dec 16 13:58:33 UTC 2021


Module:    rtems
Branch:    master
Commit:    11df65660206a9915869df39687e5c2afd66aacd
Changeset: http://git.rtems.org/rtems/commit/?id=11df65660206a9915869df39687e5c2afd66aacd

Author:    Andre Przywara <andre.przywara at arm.com>
Date:      Mon Sep 21 17:52:52 2020 +0100

libfdt: fdt_grab_space_(): Fix comparison warning

With -Wsign-compare, compilers warn about a mismatching signedness
in a comparison in fdt_grab_space_().

All the involved values cannot be negative, so let's switch the types of
the local variables to unsigned to make the compiler happy.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
Message-Id: <20200921165303.9115-4-andre.przywara at arm.com>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>

---

 cpukit/dtc/libfdt/fdt_sw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/dtc/libfdt/fdt_sw.c b/cpukit/dtc/libfdt/fdt_sw.c
index 94ce4bb..d10a720 100644
--- a/cpukit/dtc/libfdt/fdt_sw.c
+++ b/cpukit/dtc/libfdt/fdt_sw.c
@@ -93,8 +93,8 @@ static inline uint32_t sw_flags(void *fdt)
 
 static void *fdt_grab_space_(void *fdt, size_t len)
 {
-	int offset = fdt_size_dt_struct(fdt);
-	int spaceleft;
+	unsigned int offset = fdt_size_dt_struct(fdt);
+	unsigned int spaceleft;
 
 	spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt)
 		- fdt_size_dt_strings(fdt);



More information about the vc mailing list