aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/h8300_tpu.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2016-06-06 11:56:52 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2016-06-28 04:19:23 -0400
commitf2f9900caa1fbfe55484375818427093d1406c1e (patch)
tree5f56971e624f96014f962c0087de03a35f5a7dec /drivers/clocksource/h8300_tpu.c
parent691f8f878290f7a94b94fe238e28263982eb52ca (diff)
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>
Diffstat (limited to 'drivers/clocksource/h8300_tpu.c')
-rw-r--r--drivers/clocksource/h8300_tpu.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/clocksource/h8300_tpu.c b/drivers/clocksource/h8300_tpu.c
index d4c1a287c262..4faf718b30f3 100644
--- a/drivers/clocksource/h8300_tpu.c
+++ b/drivers/clocksource/h8300_tpu.c
@@ -119,15 +119,16 @@ static struct tpu_priv tpu_priv = {
119#define CH_L 0 119#define CH_L 0
120#define CH_H 1 120#define CH_H 1
121 121
122static void __init h8300_tpu_init(struct device_node *node) 122static int __init h8300_tpu_init(struct device_node *node)
123{ 123{
124 void __iomem *base[2]; 124 void __iomem *base[2];
125 struct clk *clk; 125 struct clk *clk;
126 int ret = -ENXIO;
126 127
127 clk = of_clk_get(node, 0); 128 clk = of_clk_get(node, 0);
128 if (IS_ERR(clk)) { 129 if (IS_ERR(clk)) {
129 pr_err("failed to get clock for clocksource\n"); 130 pr_err("failed to get clock for clocksource\n");
130 return; 131 return PTR_ERR(clk);
131 } 132 }
132 133
133 base[CH_L] = of_iomap(node, CH_L); 134 base[CH_L] = of_iomap(node, CH_L);
@@ -144,14 +145,13 @@ static void __init h8300_tpu_init(struct device_node *node)
144 tpu_priv.mapbase1 = base[CH_L]; 145 tpu_priv.mapbase1 = base[CH_L];
145 tpu_priv.mapbase2 = base[CH_H]; 146 tpu_priv.mapbase2 = base[CH_H];
146 147
147 clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64); 148 return clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64);
148
149 return;
150 149
151unmap_L: 150unmap_L:
152 iounmap(base[CH_H]); 151 iounmap(base[CH_H]);
153free_clk: 152free_clk:
154 clk_put(clk); 153 clk_put(clk);
154 return ret;
155} 155}
156 156
157CLOCKSOURCE_OF_DECLARE(h8300_tpu, "renesas,tpu", h8300_tpu_init); 157CLOCKSOURCE_OF_DECLARE_RET(h8300_tpu, "renesas,tpu", h8300_tpu_init);