summaryrefslogtreecommitdiffstats
path: root/cpukit/dtc/libfdt
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2020-10-01 17:46:30 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-14 16:00:44 +0100
commit65b98121dabd708b5380473ede33a4ed61a0ae30 (patch)
tree600f2985034ee2bfecc47f652eaea6c6adb3e91d /cpukit/dtc/libfdt
parentlibfdt: fdt_get_string(): Fix sequential write comparison warnings (diff)
downloadrtems-65b98121dabd708b5380473ede33a4ed61a0ae30.tar.bz2
libfdt: fdt_strerror(): Fix comparison warning
With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_strerror(). Force FDT_ERRTABSIZE to be signed (it's surely small enough to fit), so that the types match. Also move the minus sign to errval, as this is actually what we use in the next line. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-7-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'cpukit/dtc/libfdt')
-rw-r--r--cpukit/dtc/libfdt/fdt_strerror.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cpukit/dtc/libfdt/fdt_strerror.c b/cpukit/dtc/libfdt/fdt_strerror.c
index 768db66ead..b4356931b0 100644
--- a/cpukit/dtc/libfdt/fdt_strerror.c
+++ b/cpukit/dtc/libfdt/fdt_strerror.c
@@ -40,7 +40,7 @@ static struct fdt_errtabent fdt_errtable[] = {
FDT_ERRTABENT(FDT_ERR_NOPHANDLES),
FDT_ERRTABENT(FDT_ERR_BADFLAGS),
};
-#define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))
+#define FDT_ERRTABSIZE ((int)(sizeof(fdt_errtable) / sizeof(fdt_errtable[0])))
const char *fdt_strerror(int errval)
{
@@ -48,7 +48,7 @@ const char *fdt_strerror(int errval)
return "<valid offset/length>";
else if (errval == 0)
return "<no error>";
- else if (errval > -FDT_ERRTABSIZE) {
+ else if (-errval < FDT_ERRTABSIZE) {
const char *s = fdt_errtable[-errval].str;
if (s)