]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[LMB]: Fix initial lmb add region with a non-zero base
authorKumar Gala <galak@kernel.crashing.org>
Thu, 14 Feb 2008 00:58:11 +0000 (16:58 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Feb 2008 00:58:11 +0000 (16:58 -0800)
If we add to an empty lmb region with a non-zero base we will not
coalesce the number of regions down to one.  This causes problems on
ppc32 for the memory region as its assumed to only have one region.

We can fix this be easily specially casing the initial add to just
replace the dummy region.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/lmb.c

index 6390d63a2a0ea7b22381a23d4eb97bd73de61320..e34a9e586c424a3e4e55508c4048115ee6ededf6 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -134,6 +134,12 @@ static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
        unsigned long coalesced = 0;
        long adjacent, i;
 
+       if ((rgn->cnt == 1) && (rgn->region[0].size == 0)) {
+               rgn->region[0].base = base;
+               rgn->region[0].size = size;
+               return 0;
+       }
+
        /* First try and coalesce this LMB with another. */
        for (i=0; i < rgn->cnt; i++) {
                unsigned long rgnbase = rgn->region[i].base;