[PATCH 14/14] libfdt: fdt_strerror(): Fix comparison warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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

At this point we are sure that errval is negative, and since
FDT_ERRTABSIZE is surely positive, we can do some casting to make the
compiler happy.

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
---
 libfdt/fdt_strerror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c
index 768db66..efce51d 100644
--- a/libfdt/fdt_strerror.c
+++ b/libfdt/fdt_strerror.c
@@ -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 > -(int)FDT_ERRTABSIZE) {
 		const char *s = fdt_errtable[-errval].str;
 
 		if (s)
-- 
2.17.5




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux