]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/resource.c
Merge branch 'master' into upstream-fixes
[karo-tx-linux.git] / kernel / resource.c
index 129cf046e56173d16201bcc089eff410bd530eca..46286434af8066af359143df81244e0c3024de19 100644 (file)
@@ -244,6 +244,7 @@ int find_next_system_ram(struct resource *res)
 
        start = res->start;
        end = res->end;
+       BUG_ON(start >= end);
 
        read_lock(&resource_lock);
        for (p = iomem_resource.child; p ; p = p->sibling) {
@@ -254,15 +255,17 @@ int find_next_system_ram(struct resource *res)
                        p = NULL;
                        break;
                }
-               if (p->start >= start)
+               if ((p->end >= start) && (p->start < end))
                        break;
        }
        read_unlock(&resource_lock);
        if (!p)
                return -1;
        /* copy data */
-       res->start = p->start;
-       res->end = p->end;
+       if (res->start < p->start)
+               res->start = p->start;
+       if (res->end > p->end)
+               res->end = p->end;
        return 0;
 }
 #endif
@@ -404,8 +407,6 @@ int insert_resource(struct resource *parent, struct resource *new)
        return result;
 }
 
-EXPORT_SYMBOL(insert_resource);
-
 /*
  * Given an existing resource, change its start and size to match the
  * arguments.  Returns -EBUSY if it can't fit.  Existing children of