memcgroup: return negative error code in mem_cgroup_create()
authorLi Zefan <lizf@cn.fujitsu.com>
Sat, 23 Feb 2008 23:24:14 +0000 (15:24 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 24 Feb 2008 01:13:25 +0000 (17:13 -0800)
Cgroup requires the subsystem to return negative error code on error in the
create method.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index bb4d7acfbca3fc0177b213c86db6caf9ad41cf12..631002d085d1374dfdfe734f761aaf3e6a65dde3 100644 (file)
@@ -1100,7 +1100,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
                mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
 
        if (mem == NULL)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        res_counter_init(&mem->res);
 
@@ -1116,7 +1116,7 @@ free_out:
                free_mem_cgroup_per_zone_info(mem, node);
        if (cont->parent != NULL)
                kfree(mem);
-       return NULL;
+       return ERR_PTR(-ENOMEM);
 }
 
 static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,