Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup: use ns_common_init()

Don't cargo-cult the same thing over and over.

Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+4 -8
+4 -8
kernel/cgroup/namespace.c
··· 21 21 22 22 static struct cgroup_namespace *alloc_cgroup_ns(void) 23 23 { 24 - struct cgroup_namespace *new_ns; 24 + struct cgroup_namespace *new_ns __free(kfree) = NULL; 25 25 int ret; 26 26 27 27 new_ns = kzalloc(sizeof(struct cgroup_namespace), GFP_KERNEL_ACCOUNT); 28 28 if (!new_ns) 29 29 return ERR_PTR(-ENOMEM); 30 - ret = ns_alloc_inum(&new_ns->ns); 31 - if (ret) { 32 - kfree(new_ns); 30 + ret = ns_common_init(&new_ns->ns, &cgroupns_operations, true); 31 + if (ret) 33 32 return ERR_PTR(ret); 34 - } 35 - refcount_set(&new_ns->ns.count, 1); 36 - new_ns->ns.ops = &cgroupns_operations; 37 - return new_ns; 33 + return no_free_ptr(new_ns); 38 34 } 39 35 40 36 void free_cgroup_ns(struct cgroup_namespace *ns)