aboutsummaryrefslogtreecommitdiff
path: root/dtc.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-03-06 12:08:53 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2017-03-06 12:08:53 +1100
commitbad5b28049e5e0562a8ad91797fb77953a53fa20 (patch)
treed58515b0213f4d1ce2d4012dd19070dc629f5c3d /dtc.c
parent672ac09ea04d998dfddfdef3070a8af8d480182b (diff)
downloaddtc-bad5b28049e5e0562a8ad91797fb77953a53fa20.zip
dtc-bad5b28049e5e0562a8ad91797fb77953a53fa20.tar.gz
dtc-bad5b28049e5e0562a8ad91797fb77953a53fa20.tar.bz2
Fix assorted sparse warnings
This fixes a great many sparse warnings on the fdt and libfdt sources. These are mostly due to incorrect mixing of endian annotated and native integer types. This includes fixing a couple of quasi-bugs where we had endian conversions the wrong way around (this will have the right effect in practice, but is certainly conceptually incorrect). This doesn't make the whole tree sparse clean: there are many warnings in bison and lex generated code, and there are a handful of other remaining warnings that are (for now) more trouble than they're worth to fix (and are not genuine bugs). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.c')
-rw-r--r--dtc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dtc.c b/dtc.c
index bb1e52b..f5eed9d 100644
--- a/dtc.c
+++ b/dtc.c
@@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
static const char *guess_input_format(const char *fname, const char *fallback)
{
struct stat statbuf;
- uint32_t magic;
+ fdt32_t magic;
FILE *f;
if (stat(fname, &statbuf) != 0)
@@ -159,8 +159,7 @@ static const char *guess_input_format(const char *fname, const char *fallback)
}
fclose(f);
- magic = fdt32_to_cpu(magic);
- if (magic == FDT_MAGIC)
+ if (fdt32_to_cpu(magic) == FDT_MAGIC)
return "dtb";
return guess_type_by_name(fname, fallback);