Commit 38a94f4169e03494cbf850919b4b0a7e53e84bfd
Committed by
Rafael J. Wysocki
1 parent
0a4f841e9c
Exists in
master
and in
20 other branches
SH: cpuidle: check error code at init
Registering the driver, or the device, can fail, let's check the return code and return the error code to the PM layer. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Showing 3 changed files with 11 additions and 7 deletions Side-by-side Diff
arch/sh/include/asm/suspend.h
... | ... | @@ -14,9 +14,9 @@ |
14 | 14 | void sh_mobile_call_standby(unsigned long mode); |
15 | 15 | |
16 | 16 | #ifdef CONFIG_CPU_IDLE |
17 | -void sh_mobile_setup_cpuidle(void); | |
17 | +int sh_mobile_setup_cpuidle(void); | |
18 | 18 | #else |
19 | -static inline void sh_mobile_setup_cpuidle(void) {} | |
19 | +static inline int sh_mobile_setup_cpuidle(void) { return 0; } | |
20 | 20 | #endif |
21 | 21 | |
22 | 22 | /* notifier chains for pre/post sleep hooks */ |
arch/sh/kernel/cpu/shmobile/cpuidle.c
... | ... | @@ -91,15 +91,20 @@ |
91 | 91 | .state_count = 3, |
92 | 92 | }; |
93 | 93 | |
94 | -void sh_mobile_setup_cpuidle(void) | |
94 | +int __init sh_mobile_setup_cpuidle(void) | |
95 | 95 | { |
96 | + int ret; | |
97 | + | |
96 | 98 | if (sh_mobile_sleep_supported & SUSP_SH_SF) |
97 | 99 | cpuidle_driver.states[1].disabled = false; |
98 | 100 | |
99 | 101 | if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) |
100 | 102 | cpuidle_driver.states[2].disabled = false; |
101 | 103 | |
102 | - if (!cpuidle_register_driver(&cpuidle_driver)) | |
103 | - cpuidle_register_device(&cpuidle_dev); | |
104 | + ret = cpuidle_register_driver(&cpuidle_driver); | |
105 | + if (ret) | |
106 | + return ret; | |
107 | + | |
108 | + return cpuidle_register_device(&cpuidle_dev); | |
104 | 109 | } |
arch/sh/kernel/cpu/shmobile/pm.c