ARM: OMAP2+: resolve some warnings from sparse, cppcheck
Subsystems (7)
Paul Walmsley
maintainercover ARM: OMAP2+: resolve some warnings from sparse, cppcheck
Hello
This series resolves all of the current sparse warnings and many of the meaningful cppcheck warnings in arch/arm/mach-omap2.
This series is also available from git://git.pwsan.com/linux-2.6 in the branch 'sparse_cppcheck_fixes_3.4'.
- Paul
---
sparse_cppcheck_fixes_3.4
text data bss dec hex filename
6588152 692980 5594140 12875272 c47608 vmlinux.omap2plus_defconfig.orig
6588028 692956 5594140 12875124 c47574 vmlinux.omap2plus_defconfig
Paul Walmsley (5):
ARM: OMAP2+: declare file-local functions as static
ARM: OMAP2+: add includes for missing prototypes
ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse
ARM: OMAP2+: fix 'using plain integer as NULL pointer' sparse warnings
ARM: OMAP2+: clean up some cppcheck warnings
arch/arm/mach-omap2/board-am3517evm.c | 6 +----- arch/arm/mach-omap2/board-omap3evm.c | 8 ++++---- arch/arm/mach-omap2/board-omap4panda.c | 8 ++++---- arch/arm/mach-omap2/board-rx51-peripherals.c | 4 ++-- arch/arm/mach-omap2/board-zoom-display.c | 1 + 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/gpmc.c | 3 +-- arch/arm/mach-omap2/hsmmc.c | 2 +- arch/arm/mach-omap2/hwspinlock.c | 2 +- arch/arm/mach-omap2/irq.c | 3 ++- arch/arm/mach-omap2/mcbsp.c | 2 +- arch/arm/mach-omap2/mux.c | 2 +- arch/arm/mach-omap2/omap-secure.c | 1 + arch/arm/mach-omap2/omap-wakeupgen.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/serial.c | 2 +- arch/arm/mach-omap2/usb-tusb6010.c | 2 +- arch/arm/plat-omap/include/plat/dmtimer.h | 4 ++-- 22 files changed, 33 insertions(+), 40 deletions(-)
Paul Walmsley
maintainerPATCH 1/5 ARM: OMAP2+: declare file-local functions as static
Several function declarations used only in the files in which they're declared should include the static keyboard, but don't:
arch/arm/mach-omap2/serial.c:248:6: warning: symbol 'cmdline_find_option' was not declared. Should it be static? arch/arm/mach-omap2/omap-wakeupgen.c:259:6: warning: symbol 'irq_sar_clear' was not declared. Should it be static? arch/arm/mach-omap2/board-rx51-peripherals.c:878:27: warning: symbol 'rx51_vibra_data' was not declared. Should it be static? arch/arm/mach-omap2/board-rx51-peripherals.c:882:27: warning: symbol 'rx51_audio_data' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:201:29: warning: symbol 'omap_panda_wlan_data' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:393:24: warning: symbol 'omap4_panda_dvi_device' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:403:12: warning: symbol 'omap4_panda_dvi_init' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:464:6: warning: symbol 'omap4_panda_display_init' was not declared. Should it be static? arch/arm/mach-omap2/hsmmc.c:434:6: warning: symbol 'omap_init_hsmmc' was not declared. Should it be static? arch/arm/mach-omap2/hwspinlock.c:31:12: warning: symbol 'hwspinlocks_init' was not declared. Should it be static?
Mark all of these as static.
--- arch/arm/mach-omap2/board-omap4panda.c | 8 ++++---- arch/arm/mach-omap2/board-rx51-peripherals.c | 4 ++-- arch/arm/mach-omap2/hsmmc.c | 2 +- arch/arm/mach-omap2/hwspinlock.c | 2 +- arch/arm/mach-omap2/omap-wakeupgen.c | 2 +- arch/arm/mach-omap2/serial.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/board-omap4panda.c +4 -4
@@ -198,7 +198,7 @@ static struct platform_device omap_vwlan_device = { }, }; -struct wl12xx_platform_data omap_panda_wlan_data__initdata = { +static struct wl12xx_platform_data omap_panda_wlan_data__initdata = { .irq =OMAP_GPIO_IRQ (GPIO_WIFI_IRQ ),/* PANDA ref clock is 38.4 MHz */ .board_ref_clock =2 ,
@@ -390,7 +390,7 @@ static struct panel_dvi_platform_data omap4_dvi_panel = { .i2c_bus_num = 3, }; -struct omap_dss_device omap4_panda_dvi_device = { +static struct omap_dss_device omap4_panda_dvi_device = { .type =OMAP_DISPLAY_TYPE_DPI , .name ="dvi" , .driver_name ="dvi" ,
@@ -400,7 +400,7 @@ struct omap_dss_device omap4_panda_dvi_device = { .channel = OMAP_DSS_CHANNEL_LCD2, }; -int __init omap4_panda_dvi_init (void ) +static int __init omap4_panda_dvi_init (void ) {int r;
@@ -461,7 +461,7 @@ static struct omap_dss_board_info omap4_panda_dss_data = { .default_device = &omap4_panda_dvi_device, }; -void omap4_panda_display_init (void ) +static void omap4_panda_display_init (void ) {int r;
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -2
@@ -875,11 +875,11 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = { .resource_config = twl4030_rconfig, }; -struct twl4030_vibra_data rx51_vibra_data__initdata = { +static struct twl4030_vibra_data rx51_vibra_data__initdata = { .coexist =0 , }; -struct twl4030_audio_data rx51_audio_data__initdata = { +static struct twl4030_audio_data rx51_audio_data__initdata = { .audio_mclk =26000000 , .vibra = &rx51_vibra_data, };
arch/arm/mach-omap2/hsmmc.c +1 -1
@@ -431,7 +431,7 @@ static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,static int omap_hsmmc_done;#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 -void omap_init_hsmmc (struct omap2_hsmmc_info *hsmmcinfo,int ctrl_nr) +static void omap_init_hsmmc (struct omap2_hsmmc_info *hsmmcinfo,int ctrl_nr) {struct omap_hwmod *oh;struct platform_device *pdev;
arch/arm/mach-omap2/hwspinlock.c +1 -1
@@ -28,7 +28,7 @@ static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { .base_id = 0, }; -int __init hwspinlocks_init (void ) +static int __init hwspinlocks_init (void ) {int retval =0 ;struct omap_hwmod *oh;
arch/arm/mach-omap2/omap-wakeupgen.c +1 -1
@@ -256,7 +256,7 @@ static void irq_save_context(void)/* * Clear WakeupGen SAR backup status. */ -void irq_sar_clear (void ) +static void irq_sar_clear (void ) {u32 val; val =__raw_readl (sar_base +SAR_BACKUP_STATUS_OFFSET );
arch/arm/mach-omap2/serial.c +1 -1
@@ -245,7 +245,7 @@ static void omap_serial_fill_default_pads(struct omap_board_data *bdata)static void omap_serial_fill_default_pads (struct omap_board_data *bdata) {}#endif -char *cmdline_find_option (char *str) +static char *cmdline_find_option (char *str) {extern char *saved_command_line;
PATCH 1/5 ARM: OMAP2+: declare file-local functions as static
Quoted 14 lines · Paul Walmsley
Several function declarations used only in the files in which they're declared should include the static keyboard, but don't:
? ?arch/arm/mach-omap2/serial.c:248:6: warning: symbol '
cmdline_find_option' was not declared. Should it be static? ? ?arch/arm/mach-omap2/omap-wakeupgen.c:259:6: warning: symbol 'irq_sar_clear' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-rx51-peripherals.c:878:27: warning: symbol 'rx51_vibra_data' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-rx51-peripherals.c:882:27: warning: symbol 'rx51_audio_data' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-omap4panda.c:201:29: warning: symbol 'omap_panda_wlan_data' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-omap4panda.c:393:24: warning: symbol 'omap4_panda_dvi_device' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-omap4panda.c:403:12: warning: symbol 'omap4_panda_dvi_init' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-omap4panda.c:464:6: warning: symbol 'omap4_panda_display_init' was not declared. Should it be static? ? ?arch/arm/mach-omap2/hsmmc.c:434:6: warning: symbol 'omap_init_hsmmc' was not declared. Should it be static? ? ?arch/arm/mach-omap2/hwspinlock.c:31:12: warning: symbol 'hwspinlocks_init' was not declared. Should it be static?
Quoted 8 lines
Mark all of these as static.
Signed-off-by Paul Walmsley <[email protected]>Cc Govindraj R <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc David Anders <[email protected]>Cc Simon Que <[email protected]>---
For the wakeupgen change,
Paul Walmsley
maintainerPATCH 2/5 ARM: OMAP2+: add includes for missing prototypes
In reply to Paul WalmsleySeveral C files in arch/arm/mach-omap2 declare functions that are used by other files, but don't include the header file where the prototype is declared. This results in the following warnings from sparse:
arch/arm/mach-omap2/irq.c:114:5: warning: symbol 'omap_irq_pending' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:186:13: warning: symbol 'omap2_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:191:13: warning: symbol 'omap3_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:196:13: warning: symbol 'ti81xx_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:233:39: warning: symbol 'omap2_intc_handle_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:242:6: warning: symbol 'omap_intc_save_context' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:265:6: warning: symbol 'omap_intc_restore_context' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:291:6: warning: symbol 'omap3_intc_suspend' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:297:6: warning: symbol 'omap3_intc_prepare_idle' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:306:6: warning: symbol 'omap3_intc_resume_idle' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:312:39: warning: symbol 'omap3_intc_handle_irq' was not declared. Should it be static? arch/arm/mach-omap2/omap-secure.c:59:12: warning: symbol 'omap_secure_ram_reserve_memblock' was not declared. Should it be static? arch/arm/mach-omap2/board-zoom-display.c:133:13: warning: symbol 'zoom_display_init' was not declared. Should it be static?
Fix by including the appropriate header files.
--- arch/arm/mach-omap2/board-zoom-display.c | 1 + arch/arm/mach-omap2/irq.c | 1 + arch/arm/mach-omap2/omap-secure.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-display.c +1 -0
@@ -16,6 +16,7 @@#include <linux/spi/spi.h> #include <plat/mcspi.h> #include <video/omapdss.h> +#include <mach/board-zoom.h> #define LCD_PANEL_RESET_GPIO_PROD 96#define LCD_PANEL_RESET_GPIO_PILOT 55
arch/arm/mach-omap2/irq.c +1 -0
@@ -18,6 +18,7 @@#include <asm/exception.h> #include <asm/mach/irq.h> +#include "common.h" /* selected INTC register offsets */
arch/arm/mach-omap2/omap-secure.c +1 -0
@@ -18,6 +18,7 @@#include <asm/cacheflush.h> #include <asm/memblock.h> +#include <plat/omap-secure.h> #include <mach/omap-secure.h> static phys_addr_t omap_secure_memblock_base;
PATCH 2/5 ARM: OMAP2+: add includes for missing prototypes
Quoted 19 lines · Paul Walmsley
Several C files in
arch/arm/mach-omap2declare functions that are used by other files, but don't include the header file where the prototype is declared. ?This results in the following warnings from sparse:? ?arch/arm/mach-omap2/irq.c:114:5: warning: symbol '
omap_irq_pending' was not declared. Should it be static?
? ?arch/arm/mach-omap2/irq.c:186:13: warning: symbol 'omap2_init_irq' was not declared. Should it be static?
? ?arch/arm/mach-omap2/irq.c:191:13: warning: symbol 'omap3_init_irq' was not declared. Should it be static?
? ?arch/arm/mach-omap2/irq.c:196:13: warning: symbol 'ti81xx_init_irq' was not declared. Should it be static?
? ?arch/arm/mach-omap2/irq.c:233:39: warning: symbol 'omap2_intc_handle_irq' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:242:6: warning: symbol 'omap_intc_save_context' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:265:6: warning: symbol 'omap_intc_restore_context' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:291:6: warning: symbol 'omap3_intc_suspend' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:297:6: warning: symbol 'omap3_intc_prepare_idle' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:306:6: warning: symbol 'omap3_intc_resume_idle' was not declared. Should it be static? ? ?arch/arm/mach-omap2/irq.c:312:39: warning: symbol 'omap3_intc_handle_irq' was not declared. Should it be static? ? ?arch/arm/mach-omap2/omap-secure.c:59:12: warning: symbol 'omap_secure_ram_reserve_memblock' was not declared. Should it be static? ? ?arch/arm/mach-omap2/board-zoom-display.c:133:13: warning: symbol 'zoom_display_init' was not declared. Should it be static?
Quoted 6 lines
Fix by including the appropriate header files.
Signed-off-by Paul Walmsley <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Senthilvadivu Guruswamy <[email protected]>---
Thanks Paul for the fix.
Paul Walmsley
maintainerPATCH 3/5 ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse
In reply to Paul Walmsleyarch/arm/mach-omap2/gpmc.c passes a return value from ioremap() as the fifth argument to request_irq() without casting it. This causes sparse to generate the following warning:
arch/arm/mach-omap2/gpmc.c:759:63: warning: incorrect type in argument 5 (different address spaces)arch/arm/mach-omap2/gpmc.c:759:63: expected void *devarch/arm/mach-omap2/gpmc.c:759:63: got void [noderef] <asn:2>*static [toplevel] [assigned] gpmc_base
It turns out that it's not necessary to pass this. gpmc_base is a file-scoped static variable, the ISR is located in the same file ... and the ISR doesn't even touch the passed-in variable. So, just replace it with NULL in request_irq().
--- arch/arm/mach-omap2/gpmc.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +1 -2
@@ -755,8 +755,7 @@ static int __init gpmc_init(void) irq++; } - ret =request_irq (gpmc_irq, - gpmc_handle_irq,IRQF_SHARED ,"gpmc" , gpmc_base); + ret =request_irq (gpmc_irq, gpmc_handle_irq,IRQF_SHARED ,"gpmc" ,NULL );if (ret)pr_err ("gpmc: irq-%d could not claim: err %d\n" , gpmc_irq, ret);
Paul Walmsley
maintainerPATCH 4/5 ARM: OMAP2+: fix 'using plain integer as NULL pointer' sparse warnings
In reply to Paul Walmsleysparse warns when 0 is passed to a function expecting a pointer argument. Resolve these warnings by replacing the 0 with NULL.
arch/arm/plat-omap/include/plat/dmtimer.h:319:34: warning: Using plain integer as NULL pointer arch/arm/plat-omap/include/plat/dmtimer.h:324:35: warning: Using plain integer as NULL pointer arch/arm/mach-omap2/irq.c:294:22: warning: Using plain integer as NULL pointer
--- arch/arm/mach-omap2/irq.c | 2 +- arch/arm/plat-omap/include/plat/dmtimer.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/irq.c +1 -1
@@ -292,7 +292,7 @@ void omap_intc_restore_context(void)void omap3_intc_suspend (void ) {/* A pending interrupt would prevent OMAP from entering suspend */ -omap_ack_irq (0 ); +omap_ack_irq (NULL ); }void omap3_intc_prepare_idle (void )
arch/arm/plat-omap/include/plat/dmtimer.h +2 -2
@@ -316,12 +316,12 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)OMAP_TIMER_V1_SYS_STAT_OFFSET ; timer->irq_stat = timer->io_base +OMAP_TIMER_V1_STAT_OFFSET ; timer->irq_ena = timer->io_base +OMAP_TIMER_V1_INT_EN_OFFSET ; - timer->irq_dis =0 ; + timer->irq_dis =NULL ; timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; timer->func_base = timer->io_base; }else { timer->revision =2 ; - timer->sys_stat =0 ; + timer->sys_stat =NULL ; timer->irq_stat = timer->io_base +OMAP_TIMER_V2_IRQSTATUS ; timer->irq_ena = timer->io_base +OMAP_TIMER_V2_IRQENABLE_SET ; timer->irq_dis = timer->io_base +OMAP_TIMER_V2_IRQENABLE_CLR ;
Paul Walmsley
maintainerPATCH 5/5 ARM: OMAP2+: clean up some cppcheck warnings
In reply to Paul WalmsleyResolve 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.
--- 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(-)
arch/arm/mach-omap2/board-am3517evm.c +1 -5
@@ -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
arch/arm/mach-omap2/board-omap3evm.c +4 -4
@@ -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);
arch/arm/mach-omap2/devices.c +1 -2
@@ -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);
arch/arm/mach-omap2/gpio.c +2 -2
@@ -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. */ -sscanf (oh->name,"gpio%d" , &id); +sscanf (oh->name,"gpio%1d" , &id); pdata =kzalloc (sizeof (struct omap_gpio_platform_data ),GFP_KERNEL );if (!pdata) {
@@ -54,7 +54,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata->virtual_irq_start =IH_GPIO_BASE +32 * (id -1 ); pdata->regs =kzalloc (sizeof (struct omap_gpio_reg_offs ),GFP_KERNEL ); -if (!pdata) { +if (!pdata->regs) {pr_err ("gpio%d: Memory allocation failed\n" , id);return -ENOMEM ; }
arch/arm/mach-omap2/gpmc-onenand.c +1 -2
@@ -175,7 +175,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,const int t_wpl =40 ;const int t_wph =30 ;int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; -int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; +int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;int first_time =0 , hf =0 , vhf =0 , sync_read =0 , sync_write =0 ;int err, ticks_cez;int cs = cfg->cs, freq = *freq_ptr;
@@ -239,7 +239,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,break ; } - tick_ns =gpmc_ticks_to_ns (1 ); div =gpmc_cs_calc_divider (cs, min_gpmc_clk_period); gpmc_clk_ns =gpmc_ticks_to_ns (div);if (gpmc_clk_ns <15 )/* >66Mhz */
arch/arm/mach-omap2/mcbsp.c +1 -1
@@ -130,7 +130,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)struct omap_mcbsp_platform_data *pdata =NULL ;struct platform_device *pdev; -sscanf (oh->name,"mcbsp%d" , &id); +sscanf (oh->name,"mcbsp%1d" , &id); pdata =kzalloc (sizeof (struct omap_mcbsp_platform_data ),GFP_KERNEL );if (!pdata) {
arch/arm/mach-omap2/mux.c +1 -1
@@ -248,7 +248,7 @@ int omap_mux_init_signal(const char *muxname, int val)int mux_mode; mux_mode =omap_mux_get_by_name (muxname, &partition, &mux); -if (mux_mode <0 ) +if (mux_mode <0 || !mux)return mux_mode; old_mode =omap_mux_read (partition, mux->reg_offset);
arch/arm/mach-omap2/pm24xx.c +0 -3
@@ -182,8 +182,6 @@ static int omap2_allow_mpu_retention(void)static void omap2_enter_mpu_retention (void ) { -int only_idle =0 ; -/* Putting MPU into the WFI state while a transfer is active * seems to cause the I2C block to timeout. Why? Good question. */ if (omap2_i2c_active ())
@@ -206,7 +204,6 @@ static void omap2_enter_mpu_retention(void)omap2_prm_write_mod_reg (OMAP_LOGICRETSTATE_MASK ,MPU_MOD ,OMAP2_PM_PWSTCTRL ); - only_idle =1 ; }omap2_sram_idle ();
arch/arm/mach-omap2/pm34xx.c +1 -3
@@ -787,7 +787,7 @@ static void __init pm_errata_configure(void)static int __init omap3_pm_init (void ) {struct power_state *pwrst, *tmp; -struct clockdomain *neon_clkdm, *per_clkdm, *mpu_clkdm, *core_clkdm; +struct clockdomain *neon_clkdm, *mpu_clkdm;int ret;if (!cpu_is_omap34xx ())
@@ -841,8 +841,6 @@ static int __init omap3_pm_init(void) neon_clkdm =clkdm_lookup ("neon_clkdm" ); mpu_clkdm =clkdm_lookup ("mpu_clkdm" ); - per_clkdm =clkdm_lookup ("per_clkdm" ); - core_clkdm =clkdm_lookup ("core_clkdm" );#ifdef CONFIG_SUSPEND suspend_set_ops (&omap_pm_ops);
arch/arm/mach-omap2/prm_common.c +3 -1
@@ -238,7 +238,7 @@ void omap_prcm_irq_complete(void)*/ int omap_prcm_register_chain_handler (struct omap_prcm_irq_setup *irq_setup) { -int nr_regs = irq_setup->nr_regs; +int nr_regs;u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG ];int offset, i;struct irq_chip_generic *gc;
@@ -247,6 +247,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)if (!irq_setup)return -EINVAL ; + nr_regs = irq_setup->nr_regs; +if (prcm_irq_setup) {pr_err ("PRCM: already initialized; won't reinitialize\n" );return -EINVAL ;
arch/arm/mach-omap2/usb-tusb6010.c +1 -1
@@ -126,7 +126,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) tmp = (t.sync_clk + fclk_ps -1 ) / fclk_ps;if (tmp >4 )return -ERANGE ; -if (tmp <=0 ) +if (tmp ==0 ) tmp =1 ; t.page_burst_access = (fclk_ps * tmp) /1000 ;
PATCH 5/5 ARM: OMAP2+: clean up some cppcheck warnings
Quoted 1 line · Paul Walmsley
Resolve some warnings identified by cppcheck in
arch/arm/mach-omap2:
...
Quoted 1 line
[
arch/arm/mach-omap2/mcbsp.c:133]: (warning) scanf without field width limits can crash with huge input data
...
arch/arm/mach-omap2/mcbsp.c static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) · line 134
Quoted 12 lines
arch/arm/mach-omap2/mcbsp.c +1
-1@@ -130,7 +130,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)struct omap_mcbsp_platform_data *pdata =NULL ;struct platform_device *pdev; -sscanf (oh->name,"mcbsp%d" , &id); +sscanf (oh->name,"mcbsp%1d" , &id);
Correct if I'm wrong but is this a false alarm? Can %d scan more than sizeof(int)?
Anyway this shouldn't be fatal issue since name comes from kernel omap_hwmod data, i.e. only developer can hit it.
Peter: worth to check and possible add this Paul's fix to your mcbsp change set.
Signature · 1 line
Jarkko
Paul Walmsley
maintainerPATCH 5/5 ARM: OMAP2+: clean up some cppcheck warnings
Quoted 14 lines · Jarkko Nikula
Quoted 1 line · Paul Walmsley
Resolve some warnings identified by cppcheck in
arch/arm/mach-omap2:...
Quoted 1 line
[
arch/arm/mach-omap2/mcbsp.c:133]: (warning) scanf without field width limits can crash with huge input data...
Quoted 9 lines
arch/arm/mach-omap2/mcbsp.c +0
-0@@ -130,7 +130,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)struct omap_mcbsp_platform_data *pdata =NULL ;struct platform_device *pdev;
Quoted 8 lines
arch/arm/mach-omap2/mcbsp.c static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) · line 134
Quoted 3 lines
arch/arm/mach-omap2/mcbsp.c +1
-1-sscanf (oh->name,"mcbsp%d" , &id); +sscanf (oh->name,"mcbsp%1d" , &id);Correct if I'm wrong but is this a false alarm? Can %d scan more than sizeof(int)?
Anyway this shouldn't be fatal issue since name comes from kernel
omap_hwmoddata, i.e. only developer can hit it.
Yes, I wasn't too worried about this one. At the time, I didn't audit the kernel sscanf(), so I wasn't sure what its behavior was here. Glancing at that code now, it seems to ignore the field width for %d anyway. So this is probably a pointless change that can be dropped from the patch.
Thanks for the review.
- Paul
Paul Walmsley
maintainerPATCH v2 5/5 ARM: OMAP2+: clean up some cppcheck warnings
In reply to Paul WalmsleyResolve 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/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is assigned a value that is never used [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.
Thanks to Jarkko Nikula for some comments on the sscanf() warnings. It seems that the kernel sscanf() ignores the field width anyway for the %d format, so those changes have been dropped from this second version.
--- 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 | 2 +- arch/arm/mach-omap2/gpmc-onenand.c | 3 +-- 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 +- 10 files changed, 14 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +1 -5
@@ -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
arch/arm/mach-omap2/board-omap3evm.c +4 -4
@@ -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);
arch/arm/mach-omap2/devices.c +1 -2
@@ -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);
arch/arm/mach-omap2/gpio.c +1 -1
@@ -54,7 +54,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata->virtual_irq_start =IH_GPIO_BASE +32 * (id -1 ); pdata->regs =kzalloc (sizeof (struct omap_gpio_reg_offs ),GFP_KERNEL ); -if (!pdata) { +if (!pdata->regs) {pr_err ("gpio%d: Memory allocation failed\n" , id);return -ENOMEM ; }
arch/arm/mach-omap2/gpmc-onenand.c +1 -2
@@ -175,7 +175,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,const int t_wpl =40 ;const int t_wph =30 ;int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; -int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; +int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;int first_time =0 , hf =0 , vhf =0 , sync_read =0 , sync_write =0 ;int err, ticks_cez;int cs = cfg->cs, freq = *freq_ptr;
@@ -239,7 +239,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,break ; } - tick_ns =gpmc_ticks_to_ns (1 ); div =gpmc_cs_calc_divider (cs, min_gpmc_clk_period); gpmc_clk_ns =gpmc_ticks_to_ns (div);if (gpmc_clk_ns <15 )/* >66Mhz */
arch/arm/mach-omap2/mux.c +1 -1
@@ -248,7 +248,7 @@ int omap_mux_init_signal(const char *muxname, int val)int mux_mode; mux_mode =omap_mux_get_by_name (muxname, &partition, &mux); -if (mux_mode <0 ) +if (mux_mode <0 || !mux)return mux_mode; old_mode =omap_mux_read (partition, mux->reg_offset);
arch/arm/mach-omap2/pm24xx.c +0 -3
@@ -182,8 +182,6 @@ static int omap2_allow_mpu_retention(void)static void omap2_enter_mpu_retention (void ) { -int only_idle =0 ; -/* Putting MPU into the WFI state while a transfer is active * seems to cause the I2C block to timeout. Why? Good question. */ if (omap2_i2c_active ())
@@ -206,7 +204,6 @@ static void omap2_enter_mpu_retention(void)omap2_prm_write_mod_reg (OMAP_LOGICRETSTATE_MASK ,MPU_MOD ,OMAP2_PM_PWSTCTRL ); - only_idle =1 ; }omap2_sram_idle ();
arch/arm/mach-omap2/pm34xx.c +1 -3
@@ -787,7 +787,7 @@ static void __init pm_errata_configure(void)static int __init omap3_pm_init (void ) {struct power_state *pwrst, *tmp; -struct clockdomain *neon_clkdm, *per_clkdm, *mpu_clkdm, *core_clkdm; +struct clockdomain *neon_clkdm, *mpu_clkdm;int ret;if (!cpu_is_omap34xx ())
@@ -841,8 +841,6 @@ static int __init omap3_pm_init(void) neon_clkdm =clkdm_lookup ("neon_clkdm" ); mpu_clkdm =clkdm_lookup ("mpu_clkdm" ); - per_clkdm =clkdm_lookup ("per_clkdm" ); - core_clkdm =clkdm_lookup ("core_clkdm" );#ifdef CONFIG_SUSPEND suspend_set_ops (&omap_pm_ops);
arch/arm/mach-omap2/prm_common.c +3 -1
@@ -238,7 +238,7 @@ void omap_prcm_irq_complete(void)*/ int omap_prcm_register_chain_handler (struct omap_prcm_irq_setup *irq_setup) { -int nr_regs = irq_setup->nr_regs; +int nr_regs;u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG ];int offset, i;struct irq_chip_generic *gc;
@@ -247,6 +247,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)if (!irq_setup)return -EINVAL ; + nr_regs = irq_setup->nr_regs; +if (prcm_irq_setup) {pr_err ("PRCM: already initialized; won't reinitialize\n" );return -EINVAL ;
arch/arm/mach-omap2/usb-tusb6010.c +1 -1
@@ -126,7 +126,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) tmp = (t.sync_clk + fclk_ps -1 ) / fclk_ps;if (tmp >4 )return -ERANGE ; -if (tmp <=0 ) +if (tmp ==0 ) tmp =1 ; t.page_burst_access = (fclk_ps * tmp) /1000 ;
Signature · 1 line
1.7.9.1
PATCH v2 5/5 ARM: OMAP2+: clean up some cppcheck warnings
Quoted 56 lines · Paul Walmsley
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 ifirq_setupis 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/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is assigned a value that is never used
? ?[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 usedSome of them are pretty good catches, such the gpio.c:56 and usb-tusb6010.c:129.
Thanks to Jarkko Nikula for some comments on the
sscanf()warnings. It seems that the kernelsscanf()ignores the field width anyway for the %d format, so those changes have been dropped from this second version.Signed-off-by Paul Walmsley <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>Cc Peter Ujfalusi <[email protected]>Cc Jarkko Nikula <[email protected]>Cc Charulatha Varadarajan <[email protected]>---
?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 ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-omap2/gpmc-onenand.c ? ?| ? ?3 +-- ?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 +-?10 files changed, 14 insertions(+), 23 deletions(-)
[snip]
Quoted 13 lines
arch/arm/mach-omap2/gpio.c +1
-1@@ -54,7 +54,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) ? ? ? ?pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1); ? ? ? ?pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs),GFP_KERNEL ); - ? ? ? if (!pdata) { + ? ? ? if (!pdata->regs) { ? ? ? ? ? ? ? ?pr_err("gpio%d: Memory allocation failed\n", id);
Quoted 2 lines
? ? ? ? ? ? ? ?return
-ENOMEM;
? ? ? ?}
Paul Walmsley
maintainerPATCH v3 5/5 ARM: OMAP2+: clean up some cppcheck warnings
In reply to Paul WalmsleyResolve 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/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is assigned a value that is never used [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 [arch/arm/mach-omap2/board-omap3evm.c:641] -> [arch/arm/mach-omap2/board-omap3evm.c:639]: (style) Found duplicate branches for if and else.
Some of them are pretty good catches, such the gpio.c:56 and usb-tusb6010.c:129.
Thanks to Jarkko Nikula for some comments on the sscanf() warnings. It seems that the kernel sscanf() ignores the field width anyway for the %d format, so those changes have been dropped from this second version.
Thanks to Daniel Marjam?ki <[email protected]> for pointing out that a variable was unnecessarily marked static in the board-omap3evm.c change.
--- 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 | 2 +- arch/arm/mach-omap2/gpmc-onenand.c | 3 +-- 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 +- 10 files changed, 14 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +1 -5
@@ -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
arch/arm/mach-omap2/board-omap3evm.c +4 -4
@@ -634,12 +634,12 @@ static void __init omap3_evm_wl12xx_init(void)static void __init omap3_evm_init (void ) { +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);
arch/arm/mach-omap2/devices.c +1 -2
@@ -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);
arch/arm/mach-omap2/gpio.c +1 -1
@@ -54,7 +54,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata->virtual_irq_start =IH_GPIO_BASE +32 * (id -1 ); pdata->regs =kzalloc (sizeof (struct omap_gpio_reg_offs ),GFP_KERNEL ); -if (!pdata) { +if (!pdata->regs) {pr_err ("gpio%d: Memory allocation failed\n" , id);return -ENOMEM ; }
arch/arm/mach-omap2/gpmc-onenand.c +1 -2
@@ -175,7 +175,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,const int t_wpl =40 ;const int t_wph =30 ;int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; -int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; +int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;int first_time =0 , hf =0 , vhf =0 , sync_read =0 , sync_write =0 ;int err, ticks_cez;int cs = cfg->cs, freq = *freq_ptr;
@@ -239,7 +239,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,break ; } - tick_ns =gpmc_ticks_to_ns (1 ); div =gpmc_cs_calc_divider (cs, min_gpmc_clk_period); gpmc_clk_ns =gpmc_ticks_to_ns (div);if (gpmc_clk_ns <15 )/* >66Mhz */
arch/arm/mach-omap2/mux.c +1 -1
@@ -248,7 +248,7 @@ int omap_mux_init_signal(const char *muxname, int val)int mux_mode; mux_mode =omap_mux_get_by_name (muxname, &partition, &mux); -if (mux_mode <0 ) +if (mux_mode <0 || !mux)return mux_mode; old_mode =omap_mux_read (partition, mux->reg_offset);
arch/arm/mach-omap2/pm24xx.c +0 -3
@@ -182,8 +182,6 @@ static int omap2_allow_mpu_retention(void)static void omap2_enter_mpu_retention (void ) { -int only_idle =0 ; -/* Putting MPU into the WFI state while a transfer is active * seems to cause the I2C block to timeout. Why? Good question. */ if (omap2_i2c_active ())
@@ -206,7 +204,6 @@ static void omap2_enter_mpu_retention(void)omap2_prm_write_mod_reg (OMAP_LOGICRETSTATE_MASK ,MPU_MOD ,OMAP2_PM_PWSTCTRL ); - only_idle =1 ; }omap2_sram_idle ();
arch/arm/mach-omap2/pm34xx.c +1 -3
@@ -787,7 +787,7 @@ static void __init pm_errata_configure(void)static int __init omap3_pm_init (void ) {struct power_state *pwrst, *tmp; -struct clockdomain *neon_clkdm, *per_clkdm, *mpu_clkdm, *core_clkdm; +struct clockdomain *neon_clkdm, *mpu_clkdm;int ret;if (!cpu_is_omap34xx ())
@@ -841,8 +841,6 @@ static int __init omap3_pm_init(void) neon_clkdm =clkdm_lookup ("neon_clkdm" ); mpu_clkdm =clkdm_lookup ("mpu_clkdm" ); - per_clkdm =clkdm_lookup ("per_clkdm" ); - core_clkdm =clkdm_lookup ("core_clkdm" );#ifdef CONFIG_SUSPEND suspend_set_ops (&omap_pm_ops);
arch/arm/mach-omap2/prm_common.c +3 -1
@@ -238,7 +238,7 @@ void omap_prcm_irq_complete(void)*/ int omap_prcm_register_chain_handler (struct omap_prcm_irq_setup *irq_setup) { -int nr_regs = irq_setup->nr_regs; +int nr_regs;u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG ];int offset, i;struct irq_chip_generic *gc;
@@ -247,6 +247,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)if (!irq_setup)return -EINVAL ; + nr_regs = irq_setup->nr_regs; +if (prcm_irq_setup) {pr_err ("PRCM: already initialized; won't reinitialize\n" );return -EINVAL ;
arch/arm/mach-omap2/usb-tusb6010.c +1 -1
@@ -126,7 +126,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) tmp = (t.sync_clk + fclk_ps -1 ) / fclk_ps;if (tmp >4 )return -ERANGE ; -if (tmp <=0 ) +if (tmp ==0 ) tmp =1 ; t.page_burst_access = (fclk_ps * tmp) /1000 ;
Signature · 1 line
1.7.9.1