Skip to content

Commit

Permalink
ARM: EXYNOS: handle properly the return values
Browse files Browse the repository at this point in the history
The cpuidle_register_driver return value is not checked.
The init function returns always -EIO when cpuidle_register_device
fails but the error could be different.

This patch fixes that by checking the cpuidle_register_driver properly
and returning the correct value when cpuidle_register_device fails.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
  • Loading branch information
Daniel Lezcano authored and Kukjin Kim committed Apr 9, 2013
1 parent 2eb89f8 commit 5db9f43
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/arm/mach-exynos/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,17 @@ static void __init exynos5_core_down_clk(void)

static int __init exynos4_init_cpuidle(void)
{
int cpu_id;
int cpu_id, ret;
struct cpuidle_device *device;

if (soc_is_exynos5250())
exynos5_core_down_clk();

cpuidle_register_driver(&exynos4_idle_driver);
ret = cpuidle_register_driver(&exynos4_idle_driver);
if (ret) {
printk(KERN_ERR "CPUidle failed to register driver\n");
return ret;
}

for_each_cpu(cpu_id, cpu_online_mask) {
device = &per_cpu(exynos4_cpuidle_device, cpu_id);
Expand All @@ -210,9 +214,10 @@ static int __init exynos4_init_cpuidle(void)
if (cpu_id != 0)
device->state_count = 1;

if (cpuidle_register_device(device)) {
printk(KERN_ERR "CPUidle register device failed\n,");
return -EIO;
ret = cpuidle_register_device(device);
if (ret) {
printk(KERN_ERR "CPUidle register device failed\n");
return ret;
}
}

Expand Down

0 comments on commit 5db9f43

Please sign in to comment.