[CPUFREQ] cleanup up -ENOMEM handling in cpufreq_add_dev
authorDave Jones <davej@redhat.com>
Wed, 8 Jul 2009 20:30:03 +0000 (16:30 -0400)
committerDave Jones <davej@redhat.com>
Tue, 1 Sep 2009 16:45:09 +0000 (12:45 -0400)
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq.c

index ce31e6e..06eeff3 100644 (file)
@@ -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));