diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 13:15:09 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 13:15:09 -0600 |
commit | 3b3fcf2bfa6015d890d42b5a528f7fe7476632f7 (patch) | |
tree | cccc4fca1d7d91915ad679577b484c5c6a110e6d /nuttx/configs | |
parent | c9b18b049b09580260188349bb32e91b59f74965 (diff) | |
download | px4-nuttx-3b3fcf2bfa6015d890d42b5a528f7fe7476632f7.tar.gz px4-nuttx-3b3fcf2bfa6015d890d42b5a528f7fe7476632f7.tar.bz2 px4-nuttx-3b3fcf2bfa6015d890d42b5a528f7fe7476632f7.zip |
More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs.
Diffstat (limited to 'nuttx/configs')
-rw-r--r-- | nuttx/configs/ea3131/src/up_mem.c | 3 | ||||
-rw-r--r-- | nuttx/configs/ea3152/src/up_mem.c | 3 | ||||
-rw-r--r-- | nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c | 2 | ||||
-rw-r--r-- | nuttx/configs/mikroe-stm32f4/src/up_nsh.c | 4 | ||||
-rw-r--r-- | nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c | 1 | ||||
-rw-r--r-- | nuttx/configs/mx1ads/src/up_boot.c | 4 | ||||
-rw-r--r-- | nuttx/configs/olimex-lpc-h3131/src/lpc31_mem.c | 3 | ||||
-rw-r--r-- | nuttx/configs/olimex-stm32-h405/src/stm32_nsh.c | 6 | ||||
-rw-r--r-- | nuttx/configs/open1788/src/lpc17_sdraminitialize.c | 9 | ||||
-rw-r--r-- | nuttx/configs/shenzhou/src/up_ili93xx.c | 4 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/src/stm32_usb.c | 3 | ||||
-rw-r--r-- | nuttx/configs/vsn/src/sif.c | 7 |
12 files changed, 26 insertions, 23 deletions
diff --git a/nuttx/configs/ea3131/src/up_mem.c b/nuttx/configs/ea3131/src/up_mem.c index db38c2ce3..1426fe91c 100644 --- a/nuttx/configs/ea3131/src/up_mem.c +++ b/nuttx/configs/ea3131/src/up_mem.c @@ -157,7 +157,6 @@ static void lpc31_sdraminitialize(void) { - uint32_t tmp; uint32_t regval; /* These run-time calculations can be reduced dramatically if hclk is @@ -266,7 +265,7 @@ static void lpc31_sdraminitialize(void) * 16bit mode */ - tmp = getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13)); + (void)getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13)); putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16), LPC31_MPMC_DYNCONFIG0); diff --git a/nuttx/configs/ea3152/src/up_mem.c b/nuttx/configs/ea3152/src/up_mem.c index 3bd826ec3..234a4a9fc 100644 --- a/nuttx/configs/ea3152/src/up_mem.c +++ b/nuttx/configs/ea3152/src/up_mem.c @@ -157,7 +157,6 @@ static void lpc31_sdraminitialize(void) { - uint32_t tmp; uint32_t regval; /* These run-time calculations can be reduced dramatically if hclk is @@ -266,7 +265,7 @@ static void lpc31_sdraminitialize(void) * 16bit mode */ - tmp = getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13)); + (void)getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13)); putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16), LPC31_MPMC_DYNCONFIG0); diff --git a/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c b/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c index 8950147ee..eb3f81999 100644 --- a/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c +++ b/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c @@ -146,5 +146,5 @@ void stm32_board_clockconfig(void) while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_PLL) ; -#endif } +#endif diff --git a/nuttx/configs/mikroe-stm32f4/src/up_nsh.c b/nuttx/configs/mikroe-stm32f4/src/up_nsh.c index b68101c0a..0963ccf69 100644 --- a/nuttx/configs/mikroe-stm32f4/src/up_nsh.c +++ b/nuttx/configs/mikroe-stm32f4/src/up_nsh.c @@ -169,7 +169,11 @@ int nsh_archinitialize(void) FAR struct spi_dev_s *spi; FAR struct mtd_dev_s *mtd; #endif +#if defined(NSH_HAVEMMCSD) || defined(HAVE_USBHOST) || \ + defined(HAVE_USBMONITOR) || defined(CONFIG_LCD_MIO283QT2) || \ + defined(CONFIG_LCD_MIO283QT9A) int ret; +#endif /* Configure SPI-based devices */ diff --git a/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c b/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c index f8b7f5e4d..30b65e6bb 100644 --- a/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c +++ b/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c @@ -435,7 +435,6 @@ static void tc_adc_init(void) regval = tc_adc_getreg(STM32_ADC_SQR3_OFFSET) & ADC_SQR3_RESERVED; regval |= LCD_YD_CHANNEL; tc_adc_putreg(STM32_ADC_SQR3_OFFSET, regval); - regval = tc_adc_getreg(STM32_ADC_SQR3_OFFSET); /* Set the number of conversions = 1 */ diff --git a/nuttx/configs/mx1ads/src/up_boot.c b/nuttx/configs/mx1ads/src/up_boot.c index 6d7576d0c..82991c1fe 100644 --- a/nuttx/configs/mx1ads/src/up_boot.c +++ b/nuttx/configs/mx1ads/src/up_boot.c @@ -101,7 +101,7 @@ void imx_boardinitialize(void) imxgpio_configprimary(GPIOA, 21); imxgpio_configprimary(GPIOA, 22); - regval = getreg32(IMX_CS4_VSECTION + 0x0c); - regval = getreg32(IMX_CS4_VSECTION + 0x0c); + (void)getreg32(IMX_CS4_VSECTION + 0x0c); + (void)getreg32(IMX_CS4_VSECTION + 0x0c); #endif } diff --git a/nuttx/configs/olimex-lpc-h3131/src/lpc31_mem.c b/nuttx/configs/olimex-lpc-h3131/src/lpc31_mem.c index 389a62f4e..a99e6baf4 100644 --- a/nuttx/configs/olimex-lpc-h3131/src/lpc31_mem.c +++ b/nuttx/configs/olimex-lpc-h3131/src/lpc31_mem.c @@ -137,7 +137,6 @@ static uint32_t lpc31_ns2clk(uint32_t ns, uint32_t hclk2) static inline void lpc31_sdraminitialize(void) { - uint32_t tmp; uint32_t regval; /* These run-time calculations can be reduced dramatically if hclk is @@ -254,7 +253,7 @@ static inline void lpc31_sdraminitialize(void) * 16bit mode */ - tmp = getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 12)); + (void)getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 12)); /* Select normal operating mode */ diff --git a/nuttx/configs/olimex-stm32-h405/src/stm32_nsh.c b/nuttx/configs/olimex-stm32-h405/src/stm32_nsh.c index 73f7923f1..d5a65abd4 100644 --- a/nuttx/configs/olimex-stm32-h405/src/stm32_nsh.c +++ b/nuttx/configs/olimex-stm32-h405/src/stm32_nsh.c @@ -59,6 +59,10 @@ * Pre-Processor Definitions ****************************************************************************/ +#if !defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN2) +# undef CONFIG_CAN +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -84,7 +88,7 @@ int nsh_archinitialize(void) int ret; #endif -#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2)) +#ifdef CONFIG_CAN /* Configure on-board CAN if CAN support has been selected. */ ret = stm32_can_initialize(); diff --git a/nuttx/configs/open1788/src/lpc17_sdraminitialize.c b/nuttx/configs/open1788/src/lpc17_sdraminitialize.c index be4f275f4..5fa7bb910 100644 --- a/nuttx/configs/open1788/src/lpc17_sdraminitialize.c +++ b/nuttx/configs/open1788/src/lpc17_sdraminitialize.c @@ -109,11 +109,6 @@ void open1788_sdram_initialize(void) { uint32_t regval; -#ifdef CONFIG_LPC17_SDRAM_16BIT - volatile uint16_t dummy; -#else - volatile uint32_t dummy; -#endif int i; /* Reconfigure delays: @@ -211,9 +206,9 @@ void open1788_sdram_initialize(void) LPC17_EMC_DYNAMICCONTROL); #ifdef CONFIG_LPC17_SDRAM_16BIT - dummy = getreg16(SDRAM_BASE | (0x33 << 12)); /* 8 burst, 3 CAS latency */ + (void)getreg16(SDRAM_BASE | (0x33 << 12)); /* 8 burst, 3 CAS latency */ #elif defined CONFIG_LPC17_SDRAM_32BIT - dummy = getreg32(SDRAM_BASE | (0x32 << 13)); /* 4 burst, 3 CAS latency */ + (void)getreg32(SDRAM_BASE | (0x32 << 13)); /* 4 burst, 3 CAS latency */ #endif /* Issue NORMAL command */ diff --git a/nuttx/configs/shenzhou/src/up_ili93xx.c b/nuttx/configs/shenzhou/src/up_ili93xx.c index cfe27cd95..84395b6b7 100644 --- a/nuttx/configs/shenzhou/src/up_ili93xx.c +++ b/nuttx/configs/shenzhou/src/up_ili93xx.c @@ -1197,14 +1197,14 @@ static int stm32_setpower(struct lcd_dev_s *dev, int power) else #endif #ifndef CONFIG_STM32_ILI9320_DISABLE - if (priv->type == LCD_TYPE_ILI9300) + if (priv->type == LCD_TYPE_ILI9320) { stm32_writereg(priv, LCD_REG_7, 0x0173); } else #endif #ifndef CONFIG_STM32_ILI9321_DISABLE - if (priv->type == LCD_TYPE_ILI9300) + if (priv->type == LCD_TYPE_ILI9321) { stm32_writereg(priv, LCD_REG_7, 0x0173); } diff --git a/nuttx/configs/stm32f4discovery/src/stm32_usb.c b/nuttx/configs/stm32f4discovery/src/stm32_usb.c index b1b24511c..7afb60d45 100644 --- a/nuttx/configs/stm32f4discovery/src/stm32_usb.c +++ b/nuttx/configs/stm32f4discovery/src/stm32_usb.c @@ -170,7 +170,10 @@ void stm32_usbinitialize(void) int stm32_usbhost_initialize(void) { int pid; +#if defined(CONFIG_USBHOST_MSC) || defined(CONFIG_USBHOST_HIDKBD) || \ + defined(CONFIG_USBHOST_HIDMOUSE) int ret; +#endif /* First, register all of the class drivers needed to support the drivers * that we care about: diff --git a/nuttx/configs/vsn/src/sif.c b/nuttx/configs/vsn/src/sif.c index d9e859cc7..4488357af 100644 --- a/nuttx/configs/vsn/src/sif.c +++ b/nuttx/configs/vsn/src/sif.c @@ -577,7 +577,8 @@ int sif_main(int argc, char *argv[]) } else if (status != 0) { if (stpage != 0xFFFF) { - printf("Free Range:\t%d\t-\t%d\n", stpage, page-2); + printf("Free Range:\t%lu\t-\t%lu\n", + (unsigned long)stpage, (unsigned long)(page-2)); stpage = 0xFFFF; } } @@ -594,8 +595,8 @@ int sif_main(int argc, char *argv[]) size_t page = atoi(argv[2]); size_t addr = page * up_progmem_pagesize(page); - printf("Write result: %d (writing to address %xh)\n", - up_progmem_write(addr, "Test", 4), addr); + printf("Write result: %d (writing to address %lxh)\n", + up_progmem_write(addr, "Test", 4), (unsigned long)addr); return 0; } else if (!strcmp(argv[1], "i2c") && argc == 3) { |