Skip to content

Commit

Permalink
kernel/cgroup.c: kfree(NULL) is legal
Browse files Browse the repository at this point in the history
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: Jesper Juhl <[email protected]>
Cc: Paul Menage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jjuhl authored and torvalds committed Apr 3, 2009
1 parent ec64f51 commit 66bdc9c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
if (opts.release_agent)
strcpy(root->release_agent_path, opts.release_agent);
out_unlock:
if (opts.release_agent)
kfree(opts.release_agent);
kfree(opts.release_agent);
mutex_unlock(&cgroup_mutex);
mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
return ret;
Expand Down Expand Up @@ -1027,15 +1026,13 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
/* First find the desired set of subsystems */
ret = parse_cgroupfs_options(data, &opts);
if (ret) {
if (opts.release_agent)
kfree(opts.release_agent);
kfree(opts.release_agent);
return ret;
}

root = kzalloc(sizeof(*root), GFP_KERNEL);
if (!root) {
if (opts.release_agent)
kfree(opts.release_agent);
kfree(opts.release_agent);
return -ENOMEM;
}

Expand Down

0 comments on commit 66bdc9c

Please sign in to comment.