diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-15 08:16:11 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-28 04:19:34 -0400 |
commit | 2d9b65061652dcde5200998f3cebe5e736e5d9b3 (patch) | |
tree | ab03d37b540e8b535e65d2a9364c455a99d41898 /drivers/clocksource/timer-nps.c | |
parent | dcbc0eddcbbf441fdcf0eb4c2e9c1716ac235972 (diff) |
clocksource/drivers/nps: Convert init function to return error
The init functions do not return any error. They behave as the following:
- panic, thus leading to a kernel crash while another timer may work and
make the system boot up correctly
or
- print an error and let the caller unaware if the state of the system
Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.
Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/clocksource/timer-nps.c')
-rw-r--r-- | drivers/clocksource/timer-nps.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/clocksource/timer-nps.c b/drivers/clocksource/timer-nps.c index d46108920b2c..b5c7b2bd77bd 100644 --- a/drivers/clocksource/timer-nps.c +++ b/drivers/clocksource/timer-nps.c | |||
@@ -55,8 +55,8 @@ static cycle_t nps_clksrc_read(struct clocksource *clksrc) | |||
55 | return (cycle_t)ioread32be(nps_msu_reg_low_addr[cluster]); | 55 | return (cycle_t)ioread32be(nps_msu_reg_low_addr[cluster]); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void __init nps_setup_clocksource(struct device_node *node, | 58 | static int __init nps_setup_clocksource(struct device_node *node, |
59 | struct clk *clk) | 59 | struct clk *clk) |
60 | { | 60 | { |
61 | int ret, cluster; | 61 | int ret, cluster; |
62 | 62 | ||
@@ -68,7 +68,7 @@ static void __init nps_setup_clocksource(struct device_node *node, | |||
68 | ret = clk_prepare_enable(clk); | 68 | ret = clk_prepare_enable(clk); |
69 | if (ret) { | 69 | if (ret) { |
70 | pr_err("Couldn't enable parent clock\n"); | 70 | pr_err("Couldn't enable parent clock\n"); |
71 | return; | 71 | return ret; |
72 | } | 72 | } |
73 | 73 | ||
74 | nps_timer_rate = clk_get_rate(clk); | 74 | nps_timer_rate = clk_get_rate(clk); |
@@ -79,20 +79,22 @@ static void __init nps_setup_clocksource(struct device_node *node, | |||
79 | pr_err("Couldn't register clock source.\n"); | 79 | pr_err("Couldn't register clock source.\n"); |
80 | clk_disable_unprepare(clk); | 80 | clk_disable_unprepare(clk); |
81 | } | 81 | } |
82 | |||
83 | return ret; | ||
82 | } | 84 | } |
83 | 85 | ||
84 | static void __init nps_timer_init(struct device_node *node) | 86 | static int __init nps_timer_init(struct device_node *node) |
85 | { | 87 | { |
86 | struct clk *clk; | 88 | struct clk *clk; |
87 | 89 | ||
88 | clk = of_clk_get(node, 0); | 90 | clk = of_clk_get(node, 0); |
89 | if (IS_ERR(clk)) { | 91 | if (IS_ERR(clk)) { |
90 | pr_err("Can't get timer clock.\n"); | 92 | pr_err("Can't get timer clock.\n"); |
91 | return; | 93 | return PTR_ERR(clk); |
92 | } | 94 | } |
93 | 95 | ||
94 | nps_setup_clocksource(node, clk); | 96 | return nps_setup_clocksource(node, clk); |
95 | } | 97 | } |
96 | 98 | ||
97 | CLOCKSOURCE_OF_DECLARE(ezchip_nps400_clksrc, "ezchip,nps400-timer", | 99 | CLOCKSOURCE_OF_DECLARE_RET(ezchip_nps400_clksrc, "ezchip,nps400-timer", |
98 | nps_timer_init); | 100 | nps_timer_init); |