Skip to content

Commit

Permalink
[CPUFREQ] cleanup up -ENOMEM handling in cpufreq_add_dev
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Jones <davej@redhat.com>
  • Loading branch information
Dave Jones committed Sep 1, 2009
1 parent 54e6fe1 commit 059019a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,19 +798,16 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
goto module_out;
}

ret = -ENOMEM;
policy = kzalloc(sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!policy) {
ret = -ENOMEM;
if (!policy)
goto nomem_out;
}
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) {
ret = -ENOMEM;

if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
goto err_free_policy;
}
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) {
ret = -ENOMEM;

if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
goto err_free_cpumask;
}

policy->cpu = cpu;
cpumask_copy(policy->cpus, cpumask_of(cpu));
Expand Down

0 comments on commit 059019a

Please sign in to comment.