dmaengine: xgene: Set hardware dependency
[cascardo/linux.git] / kernel / pid.c
index cd36a5e..4fd07d5 100644 (file)
@@ -182,7 +182,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
                        spin_unlock_irq(&pidmap_lock);
                        kfree(page);
                        if (unlikely(!map->page))
-                               break;
+                               return -ENOMEM;
                }
                if (likely(atomic_read(&map->nr_free))) {
                        for ( ; ; ) {
@@ -210,7 +210,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
                }
                pid = mk_pid(pid_ns, map, offset);
        }
-       return -1;
+       return -EAGAIN;
 }
 
 int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
@@ -301,17 +301,20 @@ struct pid *alloc_pid(struct pid_namespace *ns)
        int i, nr;
        struct pid_namespace *tmp;
        struct upid *upid;
+       int retval = -ENOMEM;
 
        pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
        if (!pid)
-               goto out;
+               return ERR_PTR(retval);
 
        tmp = ns;
        pid->level = ns->level;
        for (i = ns->level; i >= 0; i--) {
                nr = alloc_pidmap(tmp);
-               if (nr < 0)
+               if (IS_ERR_VALUE(nr)) {
+                       retval = nr;
                        goto out_free;
+               }
 
                pid->numbers[i].nr = nr;
                pid->numbers[i].ns = tmp;
@@ -339,7 +342,6 @@ struct pid *alloc_pid(struct pid_namespace *ns)
        }
        spin_unlock_irq(&pidmap_lock);
 
-out:
        return pid;
 
 out_unlock:
@@ -351,8 +353,7 @@ out_free:
                free_pidmap(pid->numbers + i);
 
        kmem_cache_free(ns->pid_cachep, pid);
-       pid = NULL;
-       goto out;
+       return ERR_PTR(retval);
 }
 
 void disable_pid_allocation(struct pid_namespace *ns)