[U-Boot] [PATCH v2 2/2] common/memsize.c: restore content of the base address
Patrick Delaunay
patrick.delaunay at st.com
Thu Jan 25 17:07:46 UTC 2018
For the last return of function get_ram_size(),
when size=maxsize, restore the base address (*base)
content.
Add comment for the remaining case to avoid regression:
this case is already correctly handled.
Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---
Changes in v2:
- Solve issue for overlap case: don't restore saved value (invalid)
and add comment to avoid to have this issue again
common/memsize.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/common/memsize.c b/common/memsize.c
index 6dc4bb2..c315275 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -77,9 +77,16 @@ long get_ram_size(long *base, long maxsize)
addr = base + cnt;
*addr = save[--i];
}
+ /* warning: don't restore save_base in this case,
+ * it is already done in the loop because
+ * base and base+size share the same physical memory
+ * and *base is saved after *(base+size) modification
+ * in first loop
+ */
return (size);
}
}
+ *base = save_base;
return (maxsize);
}
--
2.7.4
More information about the U-Boot
mailing list