diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-03-13 16:44:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-05-02 14:54:22 -0400 |
commit | c48cd659892962f79bba4b4e0eedea8e5aa54c44 (patch) | |
tree | 0880025c1deabc9ad252db3a7fd7af7e9ab755f9 /arch/arm/mach-omap2 | |
parent | 857835c6d57aef101ac335a6da2149b54e7e0512 (diff) |
ARM: OMAP: use consistent error checking
Consistently check errors using the usual method used in the kernel
for much of its history. For instance:
int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
{
int div;
div = gpmc_calc_divider(t->sync_clk);
if (div < 0)
return div;
static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
{
...
return gpmc_cs_set_timings(cs, t);
.....
ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
if (IS_ERR_VALUE(ret))
return ret;
So, gpmc_cs_set_timings() thinks any negative return value is an error,
but where we check that in higher levels, only a limited range are
errors...
There is only _one_ use of IS_ERR_VALUE() in arch/arm which is really
appropriate, and that is in arch/arm/include/asm/syscall.h:
static inline long syscall_get_error(struct task_struct *task,
struct pt_regs *regs)
{
unsigned long error = regs->ARM_r0;
return IS_ERR_VALUE(error) ? error : 0;
}
because this function really does have to differentiate between error
return values and addresses which look like negative numbers (eg, from
mmap()).
So, here's a patch to remove them from OMAP, except for the above.
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/gpmc-onenand.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_device.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/timer.c | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 22c483d5dfa8..1957426b96fe 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -457,7 +457,7 @@ static int __init beagle_opp_init(void) | |||
457 | 457 | ||
458 | /* Initialize the omap3 opp table if not already created. */ | 458 | /* Initialize the omap3 opp table if not already created. */ |
459 | r = omap3_opp_init(); | 459 | r = omap3_opp_init(); |
460 | if (IS_ERR_VALUE(r) && (r != -EEXIST)) { | 460 | if (r < 0 && (r != -EEXIST)) { |
461 | pr_err("%s: opp default init failed\n", __func__); | 461 | pr_err("%s: opp default init failed\n", __func__); |
462 | return r; | 462 | return r; |
463 | } | 463 | } |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index e4ec3a69ee2e..2191f25ad21b 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -596,7 +596,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name) | |||
596 | return -ENOENT; | 596 | return -ENOENT; |
597 | 597 | ||
598 | r = clk_set_rate(mpurate_ck, mpurate); | 598 | r = clk_set_rate(mpurate_ck, mpurate); |
599 | if (IS_ERR_VALUE(r)) { | 599 | if (r < 0) { |
600 | WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", | 600 | WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", |
601 | mpurate_ck_name, mpurate, r); | 601 | mpurate_ck_name, mpurate, r); |
602 | clk_put(mpurate_ck); | 602 | clk_put(mpurate_ck); |
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 94a349e4dc96..7f369b4f3917 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c | |||
@@ -303,7 +303,7 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) | |||
303 | t = omap2_onenand_calc_async_timings(); | 303 | t = omap2_onenand_calc_async_timings(); |
304 | 304 | ||
305 | ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); | 305 | ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); |
306 | if (IS_ERR_VALUE(ret)) | 306 | if (ret < 0) |
307 | return ret; | 307 | return ret; |
308 | 308 | ||
309 | omap2_onenand_set_async_mode(onenand_base); | 309 | omap2_onenand_set_async_mode(onenand_base); |
@@ -325,7 +325,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) | |||
325 | t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); | 325 | t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); |
326 | 326 | ||
327 | ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); | 327 | ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); |
328 | if (IS_ERR_VALUE(ret)) | 328 | if (ret < 0) |
329 | return ret; | 329 | return ret; |
330 | 330 | ||
331 | set_onenand_cfg(onenand_base); | 331 | set_onenand_cfg(onenand_base); |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 8033cb747c86..c0a2c26ed5a4 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -709,7 +709,7 @@ static int gpmc_setup_irq(void) | |||
709 | return -EINVAL; | 709 | return -EINVAL; |
710 | 710 | ||
711 | gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); | 711 | gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); |
712 | if (IS_ERR_VALUE(gpmc_irq_start)) { | 712 | if (gpmc_irq_start < 0) { |
713 | pr_err("irq_alloc_descs failed\n"); | 713 | pr_err("irq_alloc_descs failed\n"); |
714 | return gpmc_irq_start; | 714 | return gpmc_irq_start; |
715 | } | 715 | } |
@@ -797,7 +797,7 @@ static int gpmc_mem_init(void) | |||
797 | continue; | 797 | continue; |
798 | gpmc_cs_get_memconf(cs, &base, &size); | 798 | gpmc_cs_get_memconf(cs, &base, &size); |
799 | rc = gpmc_cs_insert_mem(cs, base, size); | 799 | rc = gpmc_cs_insert_mem(cs, base, size); |
800 | if (IS_ERR_VALUE(rc)) { | 800 | if (rc < 0) { |
801 | while (--cs >= 0) | 801 | while (--cs >= 0) |
802 | if (gpmc_cs_mem_enabled(cs)) | 802 | if (gpmc_cs_mem_enabled(cs)) |
803 | gpmc_cs_delete_mem(cs); | 803 | gpmc_cs_delete_mem(cs); |
@@ -1164,14 +1164,14 @@ static int gpmc_probe(struct platform_device *pdev) | |||
1164 | GPMC_REVISION_MINOR(l)); | 1164 | GPMC_REVISION_MINOR(l)); |
1165 | 1165 | ||
1166 | rc = gpmc_mem_init(); | 1166 | rc = gpmc_mem_init(); |
1167 | if (IS_ERR_VALUE(rc)) { | 1167 | if (rc < 0) { |
1168 | clk_disable_unprepare(gpmc_l3_clk); | 1168 | clk_disable_unprepare(gpmc_l3_clk); |
1169 | clk_put(gpmc_l3_clk); | 1169 | clk_put(gpmc_l3_clk); |
1170 | dev_err(gpmc_dev, "failed to reserve memory\n"); | 1170 | dev_err(gpmc_dev, "failed to reserve memory\n"); |
1171 | return rc; | 1171 | return rc; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | if (IS_ERR_VALUE(gpmc_setup_irq())) | 1174 | if (gpmc_setup_irq() < 0) |
1175 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); | 1175 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); |
1176 | 1176 | ||
1177 | return 0; | 1177 | return 0; |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 1bc16cdafdd6..01839a0b5024 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -333,7 +333,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
333 | int oh_cnt, i, ret = 0; | 333 | int oh_cnt, i, ret = 0; |
334 | 334 | ||
335 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); | 335 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); |
336 | if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { | 336 | if (oh_cnt <= 0) { |
337 | dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); | 337 | dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); |
338 | return -ENODEV; | 338 | return -ENODEV; |
339 | } | 339 | } |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 4653efb87a27..b7c0a2d3f2c7 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1661,7 +1661,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) | |||
1661 | return -ENOSYS; | 1661 | return -ENOSYS; |
1662 | 1662 | ||
1663 | ret = _lookup_hardreset(oh, name, &ohri); | 1663 | ret = _lookup_hardreset(oh, name, &ohri); |
1664 | if (IS_ERR_VALUE(ret)) | 1664 | if (ret < 0) |
1665 | return ret; | 1665 | return ret; |
1666 | 1666 | ||
1667 | if (oh->clkdm) { | 1667 | if (oh->clkdm) { |
@@ -2387,7 +2387,7 @@ static int __init _init(struct omap_hwmod *oh, void *data) | |||
2387 | _init_mpu_rt_base(oh, NULL); | 2387 | _init_mpu_rt_base(oh, NULL); |
2388 | 2388 | ||
2389 | r = _init_clocks(oh, NULL); | 2389 | r = _init_clocks(oh, NULL); |
2390 | if (IS_ERR_VALUE(r)) { | 2390 | if (r < 0) { |
2391 | WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); | 2391 | WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); |
2392 | return -EINVAL; | 2392 | return -EINVAL; |
2393 | } | 2393 | } |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index b8ad6e632bb8..390c1b6e15bc 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -288,7 +288,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
288 | r = -EINVAL; | 288 | r = -EINVAL; |
289 | } else { | 289 | } else { |
290 | r = clk_set_parent(timer->fclk, src); | 290 | r = clk_set_parent(timer->fclk, src); |
291 | if (IS_ERR_VALUE(r)) | 291 | if (r < 0) |
292 | pr_warn("%s: %s cannot set source\n", | 292 | pr_warn("%s: %s cannot set source\n", |
293 | __func__, oh->name); | 293 | __func__, oh->name); |
294 | clk_put(src); | 294 | clk_put(src); |