platform_external_dtc/libfdt
Andre Przywara 9102211855 fdtget: Fix signedness comparisons warnings
With -Wsign-compare, compilers warn about a mismatching signedness in
the different legs of the conditional operator, in fdtget.c.

In the questionable expression, we are constructing a 16-bit value out of
two unsigned 8-bit values, however are relying on the compiler's
automatic expansion of the uint8_t to a larger type, to survive the left
shift. This larger type happens to be an "int", so this part of the
expression becomes signed.

Fix this by explicitly blowing up the uint8_t to a larger *unsigned* type,
before doing the left shift. And while we are at it, convert the hardly
readable conditional operator usage into a sane switch/case expression.

This fixes "make fdtget", when compiled with -Wsign-compare.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20210618172030.9684-3-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-21 15:27:39 +10:00
..
.gitignore Link tools and tests against libfdt shared library 2019-03-29 17:20:16 +11:00
fdt.c libfdt: Add FDT alignment check to fdt_check_header() 2021-04-07 12:44:19 +10:00
fdt.h libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_addresses.c libfdt: Allow #size-cells of 0 2019-07-28 16:31:44 +10:00
fdt_check.c libfdt: Check that the root-node name is empty 2021-03-23 12:13:06 +11:00
fdt_empty_tree.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_overlay.c libfdt: overlay: Fix comparison warning 2020-09-25 14:05:51 +10:00
fdt_ro.c libfdt: Internally perform potentially unaligned loads 2020-12-16 16:52:05 +11:00
fdt_rw.c Fix CID 1461557 2021-06-08 16:32:59 +10:00
fdt_strerror.c libfdt: fdt_strerror(): Fix comparison warning 2020-10-02 10:34:18 +10:00
fdt_sw.c Set last_comp_version correctly in new dtb and fix potential version issues in fdt_open_into 2021-01-04 12:26:37 +11:00
fdt_wip.c libfdt: libfdt_wip: Fix comparison warning 2020-10-02 10:30:07 +10:00
libfdt.h fdtget: Fix signedness comparisons warnings 2021-06-21 15:27:39 +10:00
libfdt_env.h libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
libfdt_internal.h libfdt: Tweak description of assume-aligned load helpers 2020-12-16 16:52:17 +11:00
Makefile.libfdt libfdt: Allow exclusion of fdt_check_full() 2020-02-24 13:38:44 +11:00
meson.build build-sys: add meson build 2020-10-21 14:36:07 +11:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
version.lds libfdt: De-inline fdt_header_size() 2020-02-24 13:38:44 +11:00