Skip to content

Commit f2f9900

Browse files
committed
clocksource/drivers/h8300_tpu: 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>
1 parent 691f8f8 commit f2f9900

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/clocksource/h8300_tpu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,16 @@ static struct tpu_priv tpu_priv = {
119119
#define CH_L 0
120120
#define CH_H 1
121121

122-
static void __init h8300_tpu_init(struct device_node *node)
122+
static int __init h8300_tpu_init(struct device_node *node)
123123
{
124124
void __iomem *base[2];
125125
struct clk *clk;
126+
int ret = -ENXIO;
126127

127128
clk = of_clk_get(node, 0);
128129
if (IS_ERR(clk)) {
129130
pr_err("failed to get clock for clocksource\n");
130-
return;
131+
return PTR_ERR(clk);
131132
}
132133

133134
base[CH_L] = of_iomap(node, CH_L);
@@ -144,14 +145,13 @@ static void __init h8300_tpu_init(struct device_node *node)
144145
tpu_priv.mapbase1 = base[CH_L];
145146
tpu_priv.mapbase2 = base[CH_H];
146147

147-
clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64);
148-
149-
return;
148+
return clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64);
150149

151150
unmap_L:
152151
iounmap(base[CH_H]);
153152
free_clk:
154153
clk_put(clk);
154+
return ret;
155155
}
156156

157-
CLOCKSOURCE_OF_DECLARE(h8300_tpu, "renesas,tpu", h8300_tpu_init);
157+
CLOCKSOURCE_OF_DECLARE_RET(h8300_tpu, "renesas,tpu", h8300_tpu_init);

0 commit comments

Comments
 (0)