diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-31 10:38:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-09-16 08:32:10 +0200 |
commit | ed6e965824303255cacc1c1a195d3684caa26bce (patch) | |
tree | 26e2b1b78498675ceae4dd2e990836c26ec1d5ec /drivers/clocksource | |
parent | 5bdc82c54a3306f2ae151a00f2df54f9240395b8 (diff) | |
download | barebox-ed6e965824303255cacc1c1a195d3684caa26bce.tar.gz |
resource: Let dev_request_mem_region return an error pointer
For all users fix or add the error check.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/arm_smp_twd.c | 2 | ||||
-rw-r--r-- | drivers/clocksource/bcm2835.c | 2 | ||||
-rw-r--r-- | drivers/clocksource/clps711x.c | 4 | ||||
-rw-r--r-- | drivers/clocksource/digic.c | 5 | ||||
-rw-r--r-- | drivers/clocksource/mvebu.c | 2 | ||||
-rw-r--r-- | drivers/clocksource/nomadik.c | 2 | ||||
-rw-r--r-- | drivers/clocksource/orion.c | 3 | ||||
-rw-r--r-- | drivers/clocksource/uemd.c | 5 |
8 files changed, 19 insertions, 6 deletions
diff --git a/drivers/clocksource/arm_smp_twd.c b/drivers/clocksource/arm_smp_twd.c index 3efe8ddff4..72045b05e9 100644 --- a/drivers/clocksource/arm_smp_twd.c +++ b/drivers/clocksource/arm_smp_twd.c @@ -62,6 +62,8 @@ static int smp_twd_probe(struct device_d *dev) } twd_base = dev_request_mem_region(dev, 0); + if (IS_ERR(twd_base)) + return PTR_ERR(twd_base); tick_rate = clk_get_rate(twd_clk); if (tick_rate > SMP_TWD_MAX_FREQ) { diff --git a/drivers/clocksource/bcm2835.c b/drivers/clocksource/bcm2835.c index d1df3d2b2e..c0b1aae46b 100644 --- a/drivers/clocksource/bcm2835.c +++ b/drivers/clocksource/bcm2835.c @@ -62,6 +62,8 @@ static int bcm2835_cs_probe(struct device_d *dev) rate = clk_get_rate(stc_clk); stc_base = dev_request_mem_region(dev, 0); + if (IS_ERR(stc_base)) + return PTR_ERR(stc_base); clocks_calc_mult_shift(&bcm2835_stc.mult, &bcm2835_stc.shift, rate, NSEC_PER_SEC, 60); init_clock(&bcm2835_stc); diff --git a/drivers/clocksource/clps711x.c b/drivers/clocksource/clps711x.c index 8c379d39ec..a49853f2b5 100644 --- a/drivers/clocksource/clps711x.c +++ b/drivers/clocksource/clps711x.c @@ -38,9 +38,9 @@ static int clps711x_cs_probe(struct device_d *dev) rate = clk_get_rate(timer_clk); clps711x_timer_base = dev_request_mem_region(dev, 0); - if (!clps711x_timer_base) { + if (IS_ERR(clps711x_timer_base)) { clk_put(timer_clk); - return -ENOENT; + return PTR_ERR(clps711x_timer_base); } clocks_calc_mult_shift(&clps711x_cs.mult, &clps711x_cs.shift, rate, diff --git a/drivers/clocksource/digic.c b/drivers/clocksource/digic.c index b80ef6f6fa..277bb02b63 100644 --- a/drivers/clocksource/digic.c +++ b/drivers/clocksource/digic.c @@ -19,6 +19,7 @@ #include <io.h> #include <init.h> #include <clock.h> +#include <linux/err.h> #define DIGIC_TIMER_CLOCK 1000000 @@ -44,9 +45,9 @@ static int digic_timer_probe(struct device_d *dev) return -EBUSY; timer_base = dev_request_mem_region(dev, 0); - if (!timer_base) { + if (IS_ERR(timer_base)) { dev_err(dev, "could not get memory region\n"); - return -ENODEV; + return PTR_ERR(timer_base); } clocks_calc_mult_shift(&digic_cs.mult, &digic_cs.shift, diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c index e5cb921d92..b8fa98592a 100644 --- a/drivers/clocksource/mvebu.c +++ b/drivers/clocksource/mvebu.c @@ -60,6 +60,8 @@ static int mvebu_timer_probe(struct device_d *dev) u32 rate, div, val; timer_base = dev_request_mem_region(dev, 0); + if (IS_ERR(timer_base)) + return PTR_ERR(timer_base); val = __raw_readl(timer_base + TIMER_CTRL_OFF); val &= ~(TIMER0_25MHZ | TIMER0_DIV_MASK); diff --git a/drivers/clocksource/nomadik.c b/drivers/clocksource/nomadik.c index 8a3e6d930e..d7edf06d59 100644 --- a/drivers/clocksource/nomadik.c +++ b/drivers/clocksource/nomadik.c @@ -124,6 +124,8 @@ static int nmdk_mtu_probe(struct device_d *dev) /* Save global pointer to mtu, used by functions above */ mtu_base = dev_request_mem_region(dev, 0); + if (IS_ERR(mtu_base)) + return PTR_ERR(mtu_base); /* Init the timer and register clocksource */ nmdk_timer_reset(); diff --git a/drivers/clocksource/orion.c b/drivers/clocksource/orion.c index 46932f1b05..a1dafd84de 100644 --- a/drivers/clocksource/orion.c +++ b/drivers/clocksource/orion.c @@ -49,6 +49,9 @@ static int orion_timer_probe(struct device_d *dev) uint32_t val; timer_base = dev_request_mem_region(dev, 0); + if (IS_ERR(timer_base)) + return PTR_ERR(timer_base); + tclk = clk_get(dev, NULL); /* setup TIMER0 as free-running clock source */ diff --git a/drivers/clocksource/uemd.c b/drivers/clocksource/uemd.c index 2ea455edfa..6c37de5bed 100644 --- a/drivers/clocksource/uemd.c +++ b/drivers/clocksource/uemd.c @@ -24,6 +24,7 @@ #include <init.h> #include <linux/bitops.h> #include <linux/clk.h> +#include <linux/err.h> #include <clock.h> #define TIMER_LOAD 0x00 @@ -73,9 +74,9 @@ static int uemd_timer_probe(struct device_d *dev) return -EBUSY; timer_base = dev_request_mem_region(dev, 0); - if (!timer_base) { + if (IS_ERR(timer_base)) { dev_err(dev, "could not get memory region\n"); - return -ENODEV; + return PTR_ERR(timer_base); } timer_clk = clk_get(dev, NULL); |