diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-02 14:20:01 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-28 04:19:20 -0400 |
commit | c77b9d44aceed7b85c9951a12df7c2ad865fba02 (patch) | |
tree | 3742f4bda59c65819e97835f782c5bb38eaa5338 | |
parent | 04410efbb6bc0d0e4de634b02155d1070b102adf (diff) |
clocksource/drivers/digicolor: 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>
Acked-by: Baruch Siach <baruch@tkos.co.il>
-rw-r--r-- | drivers/clocksource/timer-digicolor.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/clocksource/timer-digicolor.c b/drivers/clocksource/timer-digicolor.c index 96bb2225b84b..b929061ebe56 100644 --- a/drivers/clocksource/timer-digicolor.c +++ b/drivers/clocksource/timer-digicolor.c | |||
@@ -148,7 +148,7 @@ static u64 notrace digicolor_timer_sched_read(void) | |||
148 | return ~readl(dc_timer_dev.base + COUNT(TIMER_B)); | 148 | return ~readl(dc_timer_dev.base + COUNT(TIMER_B)); |
149 | } | 149 | } |
150 | 150 | ||
151 | static void __init digicolor_timer_init(struct device_node *node) | 151 | static int __init digicolor_timer_init(struct device_node *node) |
152 | { | 152 | { |
153 | unsigned long rate; | 153 | unsigned long rate; |
154 | struct clk *clk; | 154 | struct clk *clk; |
@@ -161,19 +161,19 @@ static void __init digicolor_timer_init(struct device_node *node) | |||
161 | dc_timer_dev.base = of_iomap(node, 0); | 161 | dc_timer_dev.base = of_iomap(node, 0); |
162 | if (!dc_timer_dev.base) { | 162 | if (!dc_timer_dev.base) { |
163 | pr_err("Can't map registers"); | 163 | pr_err("Can't map registers"); |
164 | return; | 164 | return -ENXIO; |
165 | } | 165 | } |
166 | 166 | ||
167 | irq = irq_of_parse_and_map(node, dc_timer_dev.timer_id); | 167 | irq = irq_of_parse_and_map(node, dc_timer_dev.timer_id); |
168 | if (irq <= 0) { | 168 | if (irq <= 0) { |
169 | pr_err("Can't parse IRQ"); | 169 | pr_err("Can't parse IRQ"); |
170 | return; | 170 | return -EINVAL; |
171 | } | 171 | } |
172 | 172 | ||
173 | clk = of_clk_get(node, 0); | 173 | clk = of_clk_get(node, 0); |
174 | if (IS_ERR(clk)) { | 174 | if (IS_ERR(clk)) { |
175 | pr_err("Can't get timer clock"); | 175 | pr_err("Can't get timer clock"); |
176 | return; | 176 | return PTR_ERR(clk); |
177 | } | 177 | } |
178 | clk_prepare_enable(clk); | 178 | clk_prepare_enable(clk); |
179 | rate = clk_get_rate(clk); | 179 | rate = clk_get_rate(clk); |
@@ -190,13 +190,17 @@ static void __init digicolor_timer_init(struct device_node *node) | |||
190 | ret = request_irq(irq, digicolor_timer_interrupt, | 190 | ret = request_irq(irq, digicolor_timer_interrupt, |
191 | IRQF_TIMER | IRQF_IRQPOLL, "digicolor_timerC", | 191 | IRQF_TIMER | IRQF_IRQPOLL, "digicolor_timerC", |
192 | &dc_timer_dev.ce); | 192 | &dc_timer_dev.ce); |
193 | if (ret) | 193 | if (ret) { |
194 | pr_warn("request of timer irq %d failed (%d)\n", irq, ret); | 194 | pr_warn("request of timer irq %d failed (%d)\n", irq, ret); |
195 | return ret; | ||
196 | } | ||
195 | 197 | ||
196 | dc_timer_dev.ce.cpumask = cpu_possible_mask; | 198 | dc_timer_dev.ce.cpumask = cpu_possible_mask; |
197 | dc_timer_dev.ce.irq = irq; | 199 | dc_timer_dev.ce.irq = irq; |
198 | 200 | ||
199 | clockevents_config_and_register(&dc_timer_dev.ce, rate, 0, 0xffffffff); | 201 | clockevents_config_and_register(&dc_timer_dev.ce, rate, 0, 0xffffffff); |
202 | |||
203 | return 0; | ||
200 | } | 204 | } |
201 | CLOCKSOURCE_OF_DECLARE(conexant_digicolor, "cnxt,cx92755-timer", | 205 | CLOCKSOURCE_OF_DECLARE_RET(conexant_digicolor, "cnxt,cx92755-timer", |
202 | digicolor_timer_init); | 206 | digicolor_timer_init); |