Skip to content

Commit

Permalink
sched: kfree(NULL) is valid
Browse files Browse the repository at this point in the history
kfree(NULL) is valid.

pointed out by checkpatch.pl.

the fix shrinks the code a bit:

   text    data     bss     dec     hex filename
  40024    3842     100   43966    abbe sched.o.before
  40002    3842     100   43944    aba8 sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Oct 15, 2007
1 parent 8927f49 commit a65914b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions kernel/sched.c
Original file line number Diff line number Diff line change
@@ -6784,17 +6784,14 @@ struct task_grp *sched_create_group(void)

err:
for_each_possible_cpu(i) {
if (tg->cfs_rq && tg->cfs_rq[i])
if (tg->cfs_rq)
kfree(tg->cfs_rq[i]);
if (tg->se && tg->se[i])
if (tg->se)
kfree(tg->se[i]);
}
if (tg->cfs_rq)
kfree(tg->cfs_rq);
if (tg->se)
kfree(tg->se);
if (tg)
kfree(tg);
kfree(tg->cfs_rq);
kfree(tg->se);
kfree(tg);

return ERR_PTR(-ENOMEM);
}

0 comments on commit a65914b

Please sign in to comment.