]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/resource.c
fork: fix error handling in dup_task()
[karo-tx-linux.git] / kernel / resource.c
index e1d2b8ee76d5bcd22d552c21cdf2102eaf6c7627..dc8b477644436730bea0165a1ca6fd7f179b3144 100644 (file)
@@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
 
        write_lock(&resource_lock);
 
+       if (!parent)
+               goto skip;
+
        if ((start < parent->start) || (end > parent->end))
                goto out;
 
-       for (tmp = res->child; tmp; tmp = tmp->sibling) {
-               if ((tmp->start < start) || (tmp->end > end))
-                       goto out;
-       }
-
        if (res->sibling && (res->sibling->start <= end))
                goto out;
 
@@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
                        goto out;
        }
 
+skip:
+       for (tmp = res->child; tmp; tmp = tmp->sibling)
+               if ((tmp->start < start) || (tmp->end > end))
+                       goto out;
+
        res->start = start;
        res->end = end;
        result = 0;