]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
common/memsize.c: restore content of the base address
authorPatrick Delaunay <patrick.delaunay@st.com>
Thu, 25 Jan 2018 17:07:46 +0000 (18:07 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 14 Mar 2018 01:59:30 +0000 (21:59 -0400)
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>
common/memsize.c

index 6dc4bb21b01e18e4079df7f3c8a06744dd0bc562..c31527567c3adb54949c03170d16ddcab9d95ea8 100644 (file)
@@ -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);
 }