summaryrefslogtreecommitdiff
path: root/flattree.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-08-31 16:21:23 +1000
committerJon Loeliger <jdl@freescale.com>2007-08-31 08:34:18 -0500
commitbf944970317820867895680cf0e2c4e72eefa8b1 (patch)
tree21477a6f99c64345eaf91296056379d560d9564f /flattree.c
parented0117a0c059ec0e1257573b0850081787bd651d (diff)
downloaddtc-bf944970317820867895680cf0e2c4e72eefa8b1.tar.gz
dtc: Optimise by default, fix warnings thus uncovered
This patch turns on optimisation in the Makefile by default. With the optimizer on, some uninitialized variable warnings (one real, two bogus) are now generated. This patch also squashes those again.
Diffstat (limited to 'flattree.c')
-rw-r--r--flattree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/flattree.c b/flattree.c
index 5b15e9c..e857b08 100644
--- a/flattree.c
+++ b/flattree.c
@@ -909,6 +909,7 @@ struct boot_info *dt_from_blob(FILE *f)
fprintf(stderr, "\tboot_cpuid_phys:\t0x%x\n",
be32_to_cpu(bph->boot_cpuid_phys));
+ size_str = -1;
if (version >= 3) {
size_str = be32_to_cpu(bph->size_dt_strings);
fprintf(stderr, "\tsize_dt_strings:\t%d\n", size_str);
@@ -932,10 +933,10 @@ struct boot_info *dt_from_blob(FILE *f)
inbuf_init(&memresvbuf,
blob + off_mem_rsvmap, blob + totalsize);
inbuf_init(&dtbuf, blob + off_dt, blob + totalsize);
- inbuf_init(&strbuf, blob + off_str, blob + totalsize);
-
- if (version >= 3)
- strbuf.limit = strbuf.base + size_str;
+ if (size_str >= 0)
+ inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
+ else
+ inbuf_init(&strbuf, blob + off_str, blob + totalsize);
reservelist = flat_read_mem_reserve(&memresvbuf);