aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/gpmc.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-03-13 16:44:21 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-03-13 16:44:21 -0400
commit71856843fb1d8ee455a4c1a60696c74afa4809e5 (patch)
tree23983465aca0c95e4a9dc1e4a89923c35ac2a76d /arch/arm/mach-omap2/gpmc.c
parent4d485661d799e81f98097057d445f4803cef2af0 (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/gpmc.c')
-rw-r--r--arch/arm/mach-omap2/gpmc.c8
1 files changed, 4 insertions, 4 deletions
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;