Skip to content

Commit 0cc7afc

Browse files
author
Daniel Lezcano
committed
clocksource/drivers/mps2-timer: 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: Liviu Dudau <Liviu.Dudau@arm.com>
1 parent b7357e6 commit 0cc7afc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/clocksource/mps2-timer.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int __init mps2_clocksource_init(struct device_node *np)
250250
return ret;
251251
}
252252

253-
static void __init mps2_timer_init(struct device_node *np)
253+
static int __init mps2_timer_init(struct device_node *np)
254254
{
255255
static int has_clocksource, has_clockevent;
256256
int ret;
@@ -259,17 +259,19 @@ static void __init mps2_timer_init(struct device_node *np)
259259
ret = mps2_clocksource_init(np);
260260
if (!ret) {
261261
has_clocksource = 1;
262-
return;
262+
return 0;
263263
}
264264
}
265265

266266
if (!has_clockevent) {
267267
ret = mps2_clockevent_init(np);
268268
if (!ret) {
269269
has_clockevent = 1;
270-
return;
270+
return 0;
271271
}
272272
}
273+
274+
return 0;
273275
}
274276

275-
CLOCKSOURCE_OF_DECLARE(mps2_timer, "arm,mps2-timer", mps2_timer_init);
277+
CLOCKSOURCE_OF_DECLARE_RET(mps2_timer, "arm,mps2-timer", mps2_timer_init);

0 commit comments

Comments
 (0)