]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/clocksource/armv7m_systick.c
Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block
[karo-tx-linux.git] / drivers / clocksource / armv7m_systick.c
index addfd2c64f54ef4c75aeb483d0401c1f40a77022..a315491b704751887a9427c298a4a697dddbd6a4 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/clk.h>
@@ -21,7 +22,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 +32,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 +69,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,6 +78,8 @@ 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",