Commit 66bdc9cf authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

kernel/cgroup.c: kfree(NULL) is legal

Reduces object file size a bit:

Before:
$ size kernel/cgroup.o
   text    data     bss     dec     hex filename
  21593    7804    4924   34321    8611 kernel/cgroup.o
After:
$ size kernel/cgroup.o
   text    data     bss     dec     hex filename
  21537    7744    4924   34205    859d kernel/cgroup.o
Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Cc: Paul Menage <menage@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ec64f515
...@@ -923,7 +923,6 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data) ...@@ -923,7 +923,6 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
if (opts.release_agent) if (opts.release_agent)
strcpy(root->release_agent_path, opts.release_agent); strcpy(root->release_agent_path, opts.release_agent);
out_unlock: out_unlock:
if (opts.release_agent)
kfree(opts.release_agent); kfree(opts.release_agent);
mutex_unlock(&cgroup_mutex); mutex_unlock(&cgroup_mutex);
mutex_unlock(&cgrp->dentry->d_inode->i_mutex); mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
...@@ -1027,14 +1026,12 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1027,14 +1026,12 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
/* First find the desired set of subsystems */ /* First find the desired set of subsystems */
ret = parse_cgroupfs_options(data, &opts); ret = parse_cgroupfs_options(data, &opts);
if (ret) { if (ret) {
if (opts.release_agent)
kfree(opts.release_agent); kfree(opts.release_agent);
return ret; return ret;
} }
root = kzalloc(sizeof(*root), GFP_KERNEL); root = kzalloc(sizeof(*root), GFP_KERNEL);
if (!root) { if (!root) {
if (opts.release_agent)
kfree(opts.release_agent); kfree(opts.release_agent);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment