Skip to content

Commit c48cd65

Browse files
author
Russell King
committed
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 <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 857835c commit c48cd65

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

arch/arm/mach-omap2/board-omap3beagle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int __init beagle_opp_init(void)
457457

458458
/* Initialize the omap3 opp table if not already created. */
459459
r = omap3_opp_init();
460-
if (IS_ERR_VALUE(r) && (r != -EEXIST)) {
460+
if (r < 0 && (r != -EEXIST)) {
461461
pr_err("%s: opp default init failed\n", __func__);
462462
return r;
463463
}

arch/arm/mach-omap2/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
596596
return -ENOENT;
597597

598598
r = clk_set_rate(mpurate_ck, mpurate);
599-
if (IS_ERR_VALUE(r)) {
599+
if (r < 0) {
600600
WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
601601
mpurate_ck_name, mpurate, r);
602602
clk_put(mpurate_ck);

arch/arm/mach-omap2/gpmc-onenand.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
303303
t = omap2_onenand_calc_async_timings();
304304

305305
ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
306-
if (IS_ERR_VALUE(ret))
306+
if (ret < 0)
307307
return ret;
308308

309309
omap2_onenand_set_async_mode(onenand_base);
@@ -325,7 +325,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
325325
t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
326326

327327
ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
328-
if (IS_ERR_VALUE(ret))
328+
if (ret < 0)
329329
return ret;
330330

331331
set_onenand_cfg(onenand_base);

arch/arm/mach-omap2/gpmc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static int gpmc_setup_irq(void)
709709
return -EINVAL;
710710

711711
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) {
713713
pr_err("irq_alloc_descs failed\n");
714714
return gpmc_irq_start;
715715
}
@@ -797,7 +797,7 @@ static int gpmc_mem_init(void)
797797
continue;
798798
gpmc_cs_get_memconf(cs, &base, &size);
799799
rc = gpmc_cs_insert_mem(cs, base, size);
800-
if (IS_ERR_VALUE(rc)) {
800+
if (rc < 0) {
801801
while (--cs >= 0)
802802
if (gpmc_cs_mem_enabled(cs))
803803
gpmc_cs_delete_mem(cs);
@@ -1164,14 +1164,14 @@ static int gpmc_probe(struct platform_device *pdev)
11641164
GPMC_REVISION_MINOR(l));
11651165

11661166
rc = gpmc_mem_init();
1167-
if (IS_ERR_VALUE(rc)) {
1167+
if (rc < 0) {
11681168
clk_disable_unprepare(gpmc_l3_clk);
11691169
clk_put(gpmc_l3_clk);
11701170
dev_err(gpmc_dev, "failed to reserve memory\n");
11711171
return rc;
11721172
}
11731173

1174-
if (IS_ERR_VALUE(gpmc_setup_irq()))
1174+
if (gpmc_setup_irq() < 0)
11751175
dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
11761176

11771177
return 0;

arch/arm/mach-omap2/omap_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
333333
int oh_cnt, i, ret = 0;
334334

335335
oh_cnt = of_property_count_strings(node, "ti,hwmods");
336-
if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) {
336+
if (oh_cnt <= 0) {
337337
dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n");
338338
return -ENODEV;
339339
}

arch/arm/mach-omap2/omap_hwmod.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
16611661
return -ENOSYS;
16621662

16631663
ret = _lookup_hardreset(oh, name, &ohri);
1664-
if (IS_ERR_VALUE(ret))
1664+
if (ret < 0)
16651665
return ret;
16661666

16671667
if (oh->clkdm) {
@@ -2387,7 +2387,7 @@ static int __init _init(struct omap_hwmod *oh, void *data)
23872387
_init_mpu_rt_base(oh, NULL);
23882388

23892389
r = _init_clocks(oh, NULL);
2390-
if (IS_ERR_VALUE(r)) {
2390+
if (r < 0) {
23912391
WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name);
23922392
return -EINVAL;
23932393
}

arch/arm/mach-omap2/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
288288
r = -EINVAL;
289289
} else {
290290
r = clk_set_parent(timer->fclk, src);
291-
if (IS_ERR_VALUE(r))
291+
if (r < 0)
292292
pr_warn("%s: %s cannot set source\n",
293293
__func__, oh->name);
294294
clk_put(src);

arch/arm/plat-omap/dmtimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
505505
}
506506

507507
ret = clk_set_parent(timer->fclk, parent);
508-
if (IS_ERR_VALUE(ret))
508+
if (ret < 0)
509509
pr_err("%s: failed to set %s as parent\n", __func__,
510510
parent_name);
511511

0 commit comments

Comments
 (0)