Resolve some warnings identified by cppcheck in arch/arm/mach-omap2:
[arch/arm/mach-omap2/usb-tusb6010.c:129]: (style) Checking if unsigned
variable 'tmp' is less than zero.
[arch/arm/mach-omap2/prm_common.c:241]: (error) Possible null pointer
dereference: irq_setup - otherwise it is redundant to check if irq_setup is
null at line 247
[arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'per_clkdm' is
assigned a value that is never used
[arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'core_clkdm' is
assigned a value that is never used
[arch/arm/mach-omap2/pm24xx.c:185]: (style) Variable 'only_idle' is
assigned a value that is never used
[arch/arm/mach-omap2/mux.c:254]: (error) Possible null pointer dereference:
mux
[arch/arm/mach-omap2/mux.c:258]: (error) Possible null pointer dereference:
mux
[arch/arm/mach-omap2/mcbsp.c:133]: (warning) scanf without field width
limits can crash with huge input data
[arch/arm/mach-omap2/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is
assigned a value that is never used
[arch/arm/mach-omap2/gpio.c:43]: (warning) scanf without field width limits
can crash with huge input data
[arch/arm/mach-omap2/gpio.c:56]: (error) Possible null pointer dereference:
pdata - otherwise it is redundant to check if pdata is null at line 57
[arch/arm/mach-omap2/devices.c:45]: (style) Variable 'l' is assigned a
value that is never used
[arch/arm/mach-omap2/board-am3517evm.c:134]: (style) Variable 'regval' is
assigned a value that is never used
Some of them are pretty good catches, such the gpio.c:56 and
usb-tusb6010.c:129.
Signed-off-by: Paul Walmsley
Cc: Felipe Balbi
Cc: Tony Lindgren
Cc: Kevin Hilman
Cc: Peter Ujfalusi
Cc: Jarkko Nikula
Cc: Charulatha Varadarajan
---
arch/arm/mach-omap2/board-am3517evm.c |6 +-
arch/arm/mach-omap2/board-omap3evm.c |8
arch/arm/mach-omap2/devices.c |3 +--
arch/arm/mach-omap2/gpio.c|4 ++--
arch/arm/mach-omap2/gpmc-onenand.c|3 +--
arch/arm/mach-omap2/mcbsp.c |2 +-
arch/arm/mach-omap2/mux.c |2 +-
arch/arm/mach-omap2/pm24xx.c |3 ---
arch/arm/mach-omap2/pm34xx.c |4 +---
arch/arm/mach-omap2/prm_common.c |4 +++-
arch/arm/mach-omap2/usb-tusb6010.c|2 +-
11 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-omap2/board-am3517evm.c
b/arch/arm/mach-omap2/board-am3517evm.c
index 4b1cfe3..24b1f9a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -150,13 +150,9 @@ static void am3517_evm_ethernet_init(struct
emac_platform_data *pdata)
regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
regval = regval & (~(AM35XX_CPGMACSS_SW_RST));
omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
- regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
-
- return ;
+ omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
}
-
-
#define LCD_PANEL_PWR 176
#define LCD_PANEL_BKLIGHT_PWR 182
#define LCD_PANEL_PWM 181
diff --git a/arch/arm/mach-omap2/board-omap3evm.c
b/arch/arm/mach-omap2/board-omap3evm.c
index c877236..becf41d 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -634,12 +634,12 @@ static void __init omap3_evm_wl12xx_init(void)
static void __init omap3_evm_init(void)
{
+ static struct omap_board_mux *obm;
+
omap3_evm_get_revision();
- if (cpu_is_omap3630())
- omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB);
- else
- omap3_mux_init(omap35x_board_mux, OMAP_PACKAGE_CBB);
+ obm = (cpu_is_omap3630()) ? omap36x_board_mux : omap35x_board_mux;
+ omap3_mux_init(obm, OMAP_PACKAGE_CBB);
omap_board_config = omap3_evm_config;
omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 283d11e..b52cd16 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -42,7 +42,6 @@
static int __init omap3_l3_init(void)
{
- int l;
struct omap_hwmod *oh;
struct platform_device *pdev;
char oh_name[L3_MODULES_MAX_LEN];
@@ -54,7 +53,7 @@ static int __init omap3_l3_init(void)
if (!(cpu_is_omap34xx()))
return -ENODEV;
- l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
+ snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
oh = omap_hwmod_lookup(oh_name);
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 8cbfbc2..f64fcb2 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -40,7 +40,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void
*unused)
* not change. If changed, make corresponding change here
* or make use of static variable mechanism to handle this.