]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/resource.c
fork,memcg: alloc_thread_stack_node needs to set tsk->stack
[mirror_ubuntu-bionic-kernel.git] / kernel / resource.c
index cb99e8ed9976d55d3582642c1923ae2143fd82f5..ea80a68a7fbc37abc2db6e9e332f67c1581323c3 100644 (file)
@@ -358,7 +358,7 @@ EXPORT_SYMBOL(release_resource);
  *
  * If a resource is found, returns 0 and *res is overwritten with the part
  * of the resource that's within [start..end]; if none is found, returns
- * -1.
+ * -ENODEV.  Returns -EINVAL for invalid parameters.
  *
  * This function walks the whole tree and not just first level children
  * unless @first_level_children_only is true.
@@ -392,16 +392,16 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end,
                        break;
        }
 
+       if (p) {
+               /* copy data */
+               res->start = max(start, p->start);
+               res->end = min(end, p->end);
+               res->flags = p->flags;
+               res->desc = p->desc;
+       }
+
        read_unlock(&resource_lock);
-       if (!p)
-               return -1;
-
-       /* copy data */
-       res->start = max(start, p->start);
-       res->end = min(end, p->end);
-       res->flags = p->flags;
-       res->desc = p->desc;
-       return 0;
+       return p ? 0 : -ENODEV;
 }
 
 static int __walk_iomem_res_desc(resource_size_t start, resource_size_t end,