diff options
author | Patrick Delaunay | 2018-01-25 18:07:46 +0100 |
---|---|---|
committer | Tom Rini | 2018-03-13 21:59:30 -0400 |
commit | 218da804ef0971ecee8063c45deae0345e344812 (patch) | |
tree | e6b22973a46573e9c7be6e18e21d631446c74924 /common/memsize.c | |
parent | c5da05cd412e1656fe3d1909966013fc121c5c5c (diff) |
common/memsize.c: restore content of the base address
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@st.com>
Diffstat (limited to 'common/memsize.c')
-rw-r--r-- | common/memsize.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/memsize.c b/common/memsize.c index 6dc4bb21b01..c31527567c3 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); } |