提交 059019a3 编写于 作者: D Dave Jones

[CPUFREQ] cleanup up -ENOMEM handling in cpufreq_add_dev

Signed-off-by: NDave Jones <davej@redhat.com>
上级 54e6fe16
...@@ -798,19 +798,16 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -798,19 +798,16 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
goto module_out; goto module_out;
} }
ret = -ENOMEM;
policy = kzalloc(sizeof(struct cpufreq_policy), GFP_KERNEL); policy = kzalloc(sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!policy) { if (!policy)
ret = -ENOMEM;
goto nomem_out; goto nomem_out;
}
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) { if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
ret = -ENOMEM;
goto err_free_policy; goto err_free_policy;
}
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
ret = -ENOMEM;
goto err_free_cpumask; goto err_free_cpumask;
}
policy->cpu = cpu; policy->cpu = cpu;
cpumask_copy(policy->cpus, cpumask_of(cpu)); cpumask_copy(policy->cpus, cpumask_of(cpu));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册