Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1432847
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 22/92] clocksource/drivers/armv7m_systick: Convert init function to return error |
| Date | 2016-06-28 13:00 +0200 |
| Message-ID | <rOYUj-5RL-73@gated-at.bofh.it> (permalink) |
| References | <rOYAV-5IE-3@gated-at.bofh.it> <rOYAV-5IE-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Maxime Coquelin <maxime.coquelin@st.com>
---
drivers/clocksource/armv7m_systick.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/clocksource/armv7m_systick.c b/drivers/clocksource/armv7m_systick.c
index addfd2c..2b55410 100644
--- a/drivers/clocksource/armv7m_systick.c
+++ b/drivers/clocksource/armv7m_systick.c
@@ -21,7 +21,7 @@
#define SYSTICK_LOAD_RELOAD_MASK 0x00FFFFFF
-static void __init system_timer_of_register(struct device_node *np)
+static int __init system_timer_of_register(struct device_node *np)
{
struct clk *clk = NULL;
void __iomem *base;
@@ -31,22 +31,26 @@ static void __init system_timer_of_register(struct device_node *np)
base = of_iomap(np, 0);
if (!base) {
pr_warn("system-timer: invalid base address\n");
- return;
+ return -ENXIO;
}
ret = of_property_read_u32(np, "clock-frequency", &rate);
if (ret) {
clk = of_clk_get(np, 0);
- if (IS_ERR(clk))
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
goto out_unmap;
+ }
ret = clk_prepare_enable(clk);
if (ret)
goto out_clk_put;
rate = clk_get_rate(clk);
- if (!rate)
+ if (!rate) {
+ ret = -EINVAL;
goto out_clk_disable;
+ }
}
writel_relaxed(SYSTICK_LOAD_RELOAD_MASK, base + SYST_RVR);
@@ -64,7 +68,7 @@ static void __init system_timer_of_register(struct device_node *np)
pr_info("ARM System timer initialized as clocksource\n");
- return;
+ return 0;
out_clk_disable:
clk_disable_unprepare(clk);
@@ -73,7 +77,9 @@ out_clk_put:
out_unmap:
iounmap(base);
pr_warn("ARM System timer register failed (%d)\n", ret);
+
+ return ret;
}
-CLOCKSOURCE_OF_DECLARE(arm_systick, "arm,armv7m-systick",
+CLOCKSOURCE_OF_DECLARE_RET(arm_systick, "arm,armv7m-systick",
system_timer_of_register);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/92] clocksource/drivers/armada-370-xp: Make syscore_ops static Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 63/92] clocksource/drivers/vt8500: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 15/92] clocksource/drivers/exynos_mct: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 74/92] clocksource/drivers/bcm_kona: Remove useless header <asm/mach/time.h> Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
Re: [PATCH 74/92] clocksource/drivers/bcm_kona: Remove useless header <asm/mach/time.h> Ray Jui <ray.jui@broadcom.com> - 2016-06-29 08:00 +0200
[PATCH 14/92] clocksource/drivers/mtk_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 65/92] clocksource/drivers/microblaze: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 66/92] clocksource/drivers/ralink: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 58/92] clocksource/drivers/sun5i: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 04/92] clocksource/drivers/samsung_pwm: Fix typo in Kconfig Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 71/92] clocksource/drivers/oxnas-rps: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:40 +0200
[PATCH 42/92] clocksource/drivers/tango_xtal: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 30/92] clocksource/drivers/h8300_timer8: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 43/92] clocksource/drivers/tegra20: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 41/92] clocksource/drivers/sun4i: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 47/92] clocksource/drivers/orion: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 52/92] clocksource/drivers/prima2: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 23/92] clocksource/drivers/bcm2835_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 26/92] clocksource/drivers/fsl_ftm_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 37/92] clocksource/drivers/nomadik-mtu: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 49/92] clocksource/drivers/atlas7: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 40/92] clocksource/drivers/samsung_pwm: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 46/92] clocksource/drivers/time-lpc32xx: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 45/92] clocksource/drivers/time-efm32: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 20/92] clocksource/drivers/clps711x: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 44/92] clocksource/drivers/time-armada-370-xp: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 25/92] clocksource/drivers/clksrc-dbx500: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 54/92] clocksource/drivers/integrator-ap: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 48/92] clocksource/drivers/pistachio: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 12:50 +0200
[PATCH 38/92] clocksource/drivers/pxa: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 32/92] clocksource/drivers/meson6_timer.c: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 29/92] clocksource/drivers/h8300_timer16: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 13/92] clocksource/drivers/rockchip_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 24/92] clocksource/drivers/bcm_kona: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 34/92] clocksource/drivers/moxart: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 27/92] clocksource/drivers/arm_arch_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 17/92] clocksource/drivers/cadence_ttc: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 35/92] clocksource/drivers/mps2-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 31/92] clocksource/drivers/h8300_tpu: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 28/92] clocksource/drivers/arm_global_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 39/92] clocksource/drivers/qcom: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 22/92] clocksource/drivers/armv7m_systick: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 36/92] clocksource/drivers/mxs: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 33/92] clocksource/drivers/mips-gic-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:00 +0200
[PATCH 06/92] clocksource/drivers/rockchip: Add the dynamic irq flag to the timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 08/92] arm64: dts: rockchip: Add rktimer device node for rk3399 Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 18/92] clocksource/drivers/st_lpc: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 07/92] clocksource/drivers/rockchip: Add support for the rk3399 SoC Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 12/92] clocksource/drivers/clksrc-probe: Introduce init functions with return code Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 02/92] clocksource/drivers/digicolor: Fix warning of non-static function Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 10/92] dt-bindings: clocksource: Add Oxford Semiconductor RPS Timer bindings Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 09/92] clocksource/drivers/oxnas-rps: Add Oxford Semiconductor RPS Dual Timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
[PATCH 19/92] clocksource/drivers/dw_apb_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-28 13:10 +0200
csiph-web