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-03-13 16:44:21 -0400 |
commit | 71856843fb1d8ee455a4c1a60696c74afa4809e5 (patch) | |
tree | 23983465aca0c95e4a9dc1e4a89923c35ac2a76d /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 4d485661d799e81f98097057d445f4803cef2af0 (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/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 | } |