aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-08-03 11:21:10 -0400
committerPaul Walmsley <paul@pwsan.com>2012-09-12 04:57:04 -0400
commita032d33b65c89a781c871fd1def595fa6a69b52a (patch)
tree261f10d449f72e6b30f573217e806ff649057304 /arch/arm/mach-omap2
parent55d512e245bc7699a8800e23df1a24195dd08217 (diff)
ARM: OMAP: clean up some smatch warnings, fix some printk(KERN_ERR ...
Resolve the following warnings from smatch: arch/arm/mach-omap2/gpmc.c:282 gpmc_cs_set_timings() info: why not propagate 'div' from gpmc_cs_calc_divider() instead of -1? arch/arm/mach-omap2/serial.c:328 omap_serial_init_port() error: 'pdev' dereferencing possible ERR_PTR() arch/arm/mach-omap2/timer.c:213 omap2_gp_clockevent_init() Error invalid range 4096 to -1 arch/arm/mach-omap2/gpio.c:63 omap2_gpio_dev_init() warn: possible memory leak of 'pdata' arch/arm/mach-omap2/omap_hwmod.c:1478 _assert_hardreset() warn: assigning -22 to unsigned variable 'ret' arch/arm/mach-omap2/omap_hwmod.c:1487 _assert_hardreset() warn: 4294963201 is more than 255 (max '(ret)' can be) so this is always the same. arch/arm/mach-omap2/omap_hwmod.c:1545 _read_hardreset() warn: assigning -22 to unsigned variable 'ret' arch/arm/mach-omap2/omap_hwmod.c:1554 _read_hardreset() warn: 4294963201 is more than 255 (max '(ret)' can be) so this is always the same. arch/arm/mach-omap2/dpll3xxx.c:629 omap3_clkoutx2_recalc() error: we previously assumed 'pclk' could be null (see line 627) arch/arm/mach-omap2/board-n8x0.c:422 n8x0_mmc_late_init() Error invalid range 14 to 13 arch/arm/mach-omap1/leds-h2p2-debug.c:71 h2p2_dbg_leds_event() error: potentially derefencing uninitialized 'fpga'. arch/arm/plat-omap/mux.c:79 omap_cfg_reg() Error invalid range 4096 to -1 Thanks to Tony Lindgren <tony@atomide.com> for pointing out that BUG() can be disabled. The changes in the first version that removed the subsequent return() after BUG() states have been dropped. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c7
-rw-r--r--arch/arm/mach-omap2/gpio.c1
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c12
-rw-r--r--arch/arm/mach-omap2/serial.c7
-rw-r--r--arch/arm/mach-omap2/timer.c2
6 files changed, 19 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index b9c8d2f6a81f..4d0e645cab5f 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -623,8 +623,11 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
623 while (pclk && !pclk->dpll_data) 623 while (pclk && !pclk->dpll_data)
624 pclk = pclk->parent; 624 pclk = pclk->parent;
625 625
626 /* clk does not have a DPLL as a parent? */ 626 /* clk does not have a DPLL as a parent? error in the clock data */
627 WARN_ON(!pclk); 627 if (!pclk) {
628 WARN_ON(1);
629 return 0;
630 }
628 631
629 dd = pclk->dpll_data; 632 dd = pclk->dpll_data;
630 633
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 9ad7d489b0de..30a3a94ab1ef 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -60,6 +60,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
60 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL); 60 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
61 if (!pdata->regs) { 61 if (!pdata->regs) {
62 pr_err("gpio%d: Memory allocation failed\n", id); 62 pr_err("gpio%d: Memory allocation failed\n", id);
63 kfree(pdata);
63 return -ENOMEM; 64 return -ENOMEM;
64 } 65 }
65 66
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index b2b5759ab0fe..f682e071c66f 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -279,7 +279,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
279 279
280 div = gpmc_cs_calc_divider(cs, t->sync_clk); 280 div = gpmc_cs_calc_divider(cs, t->sync_clk);
281 if (div < 0) 281 if (div < 0)
282 return -1; 282 return div;
283 283
284 GPMC_SET_ONE(GPMC_CS_CONFIG2, 0, 3, cs_on); 284 GPMC_SET_ONE(GPMC_CS_CONFIG2, 0, 3, cs_on);
285 GPMC_SET_ONE(GPMC_CS_CONFIG2, 8, 12, cs_rd_off); 285 GPMC_SET_ONE(GPMC_CS_CONFIG2, 8, 12, cs_rd_off);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 6ca8e519968d..bd69eaefcc97 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1438,8 +1438,8 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1438 * Return the bit position of the reset line that match the 1438 * Return the bit position of the reset line that match the
1439 * input name. Return -ENOENT if not found. 1439 * input name. Return -ENOENT if not found.
1440 */ 1440 */
1441static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name, 1441static int _lookup_hardreset(struct omap_hwmod *oh, const char *name,
1442 struct omap_hwmod_rst_info *ohri) 1442 struct omap_hwmod_rst_info *ohri)
1443{ 1443{
1444 int i; 1444 int i;
1445 1445
@@ -1475,7 +1475,7 @@ static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name,
1475static int _assert_hardreset(struct omap_hwmod *oh, const char *name) 1475static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1476{ 1476{
1477 struct omap_hwmod_rst_info ohri; 1477 struct omap_hwmod_rst_info ohri;
1478 u8 ret = -EINVAL; 1478 int ret = -EINVAL;
1479 1479
1480 if (!oh) 1480 if (!oh)
1481 return -EINVAL; 1481 return -EINVAL;
@@ -1484,7 +1484,7 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1484 return -ENOSYS; 1484 return -ENOSYS;
1485 1485
1486 ret = _lookup_hardreset(oh, name, &ohri); 1486 ret = _lookup_hardreset(oh, name, &ohri);
1487 if (IS_ERR_VALUE(ret)) 1487 if (ret < 0)
1488 return ret; 1488 return ret;
1489 1489
1490 ret = soc_ops.assert_hardreset(oh, &ohri); 1490 ret = soc_ops.assert_hardreset(oh, &ohri);
@@ -1542,7 +1542,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1542static int _read_hardreset(struct omap_hwmod *oh, const char *name) 1542static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1543{ 1543{
1544 struct omap_hwmod_rst_info ohri; 1544 struct omap_hwmod_rst_info ohri;
1545 u8 ret = -EINVAL; 1545 int ret = -EINVAL;
1546 1546
1547 if (!oh) 1547 if (!oh)
1548 return -EINVAL; 1548 return -EINVAL;
@@ -1551,7 +1551,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1551 return -ENOSYS; 1551 return -ENOSYS;
1552 1552
1553 ret = _lookup_hardreset(oh, name, &ohri); 1553 ret = _lookup_hardreset(oh, name, &ohri);
1554 if (IS_ERR_VALUE(ret)) 1554 if (ret < 0)
1555 return ret; 1555 return ret;
1556 1556
1557 return soc_ops.is_hardreset_asserted(oh, &ohri); 1557 return soc_ops.is_hardreset_asserted(oh, &ohri);
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index c1b93c752d70..0cc79d34c9f0 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -313,8 +313,11 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
313 313
314 pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size, 314 pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
315 NULL, 0, false); 315 NULL, 0, false);
316 WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n", 316 if (IS_ERR(pdev)) {
317 name, oh->name); 317 WARN(1, "Could not build omap_device for %s: %s.\n", name,
318 oh->name);
319 return;
320 }
318 321
319 if ((console_uart_id == bdata->id) && no_console_suspend) 322 if ((console_uart_id == bdata->id) && no_console_suspend)
320 omap_device_disable_idle_on_suspend(pdev); 323 omap_device_disable_idle_on_suspend(pdev);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 2ff6d41ec6c6..7e688c7c85bb 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -211,7 +211,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
211 res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source); 211 res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
212 BUG_ON(res); 212 BUG_ON(res);
213 213
214 omap2_gp_timer_irq.dev_id = (void *)&clkev; 214 omap2_gp_timer_irq.dev_id = &clkev;
215 setup_irq(clkev.irq, &omap2_gp_timer_irq); 215 setup_irq(clkev.irq, &omap2_gp_timer_irq);
216 216
217 __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); 217 __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW);