sched: Fix __schedule_bug() output when called from an interrupt
[linux-flexiantxendom0-3.2.10.git] / kernel / resource.c
index 3b3cedc..7640b3a 100644 (file)
@@ -7,7 +7,7 @@
  * Arbitrary resource management.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -419,6 +419,9 @@ static int __find_resource(struct resource *root, struct resource *old,
                else
                        tmp.end = root->end;
 
+               if (tmp.end < tmp.start)
+                       goto next;
+
                resource_clip(&tmp, constraint->min, constraint->max);
                arch_remove_reservations(&tmp);
 
@@ -436,8 +439,10 @@ static int __find_resource(struct resource *root, struct resource *old,
                                return 0;
                        }
                }
-               if (!this)
+
+next:          if (!this || this->end == root->end)
                        break;
+
                if (this != old)
                        tmp.start = this->end + 1;
                this = this->sibling;