mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
Many changes to reduce complaints from CppCheck. Several latent bugs fixes, but probably some new typos introduced
This commit is contained in:
@@ -228,7 +228,7 @@ void up_enable_irq(int irq)
|
||||
|
||||
void up_maskack_irq(int irq)
|
||||
{
|
||||
uint32_t reg = getreg32(INT_CTRL_REG);
|
||||
uint32_t reg;
|
||||
|
||||
/* Mask the interrupt */
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen)
|
||||
dbg("buflen=%d\n", buflen);
|
||||
if (buflen >= 18)
|
||||
{
|
||||
sprintf(buffer, "#08x %08x\n", c5471_wdt_cntl, c5471_wdt_count);
|
||||
sprintf(buffer, "%08x %08x\n", c5471_wdt_cntl, c5471_wdt_count);
|
||||
return 18;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -112,7 +112,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
|
||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||
size_t usize = CONFIG_RAM_END - ubase;
|
||||
int log2;
|
||||
|
||||
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
||||
|
||||
@@ -151,9 +150,6 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
||||
*/
|
||||
|
||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||
size_t usize = CONFIG_RAM_END - ubase;
|
||||
int log2;
|
||||
|
||||
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
|
||||
|
||||
/* Return the kernel heap settings (i.e., the part of the heap region
|
||||
|
||||
@@ -1254,7 +1254,7 @@ static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursora
|
||||
attrib->size.w = getreg16(DM320_OSD_CURXL);
|
||||
attrib->size.h = getreg16(DM320_OSD_CURYL);
|
||||
#endif
|
||||
irqrestore();
|
||||
irqrestore(flags);
|
||||
|
||||
attrib->mxsize.w = MAX_XRES;
|
||||
attrib->mxsize.h = MAX_YRES;
|
||||
@@ -1325,10 +1325,8 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs
|
||||
settings->size.h = MAX_YRES;
|
||||
}
|
||||
|
||||
flags = irqsave();
|
||||
putreg16(settings->size.w, DM320_OSD_CURXL);
|
||||
putreg16(settings->size.h, DM320_OSD_CURYL);
|
||||
restore_flags(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1342,7 +1340,7 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs
|
||||
regval &= ~1;
|
||||
}
|
||||
putreg16(regval, DM320_OSD_RECTCUR);
|
||||
restore_flags(flags);
|
||||
irqrestore(flags);
|
||||
|
||||
gvdbg("DM320_OSD_CURXP: %04x\n", getreg16(DM320_OSD_CURXP));
|
||||
gvdbg("DM320_OSD_CURYP: %04x\n", getreg16(DM320_OSD_CURYP));
|
||||
|
||||
@@ -1761,7 +1761,7 @@ static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
|
||||
|
||||
/* FIFO address, max packet size, dual/single buffered */
|
||||
|
||||
dm320_putreg8(addrhi, DM320_USB_TXFIFO1);
|
||||
dm320_putreg8(addrlo, DM320_USB_TXFIFO1);
|
||||
dm320_putreg8(addrhi|g_epinfo[i].fifo, DM320_USB_TXFIFO2);
|
||||
|
||||
/* TX endpoint max packet size */
|
||||
|
||||
@@ -879,8 +879,10 @@ static int up_interrupt(int irq, void *context)
|
||||
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
|
||||
struct inode *inode = filep->f_inode;
|
||||
struct uart_dev_s *dev = inode->i_private;
|
||||
#endif
|
||||
int ret = OK;
|
||||
|
||||
switch (cmd)
|
||||
|
||||
@@ -500,10 +500,10 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer,
|
||||
{
|
||||
#ifndef CONFIG_SPI_POLLWAIT
|
||||
irqstate_t flags;
|
||||
#endif
|
||||
uint32_t regval;
|
||||
int ntxd;
|
||||
int ret;
|
||||
#endif
|
||||
int ntxd;
|
||||
|
||||
/* Set up to perform the transfer */
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->ie |= UART_C2_RIE;
|
||||
priv->ie &= ~UART_C2_RIE;
|
||||
up_setuartint(priv);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,9 @@ extern void _vectors(void);
|
||||
|
||||
void __start(void)
|
||||
{
|
||||
#ifdef CONFIG_BOOT_RUNFROMFLASH
|
||||
const uint32_t *src;
|
||||
#endif
|
||||
uint32_t *dest;
|
||||
|
||||
/* Configure the uart so that we can get debug output as soon as possible */
|
||||
|
||||
+304
-264
File diff suppressed because it is too large
Load Diff
@@ -214,7 +214,7 @@ static inline int sam_configinterrupt(uintptr_t base, uint32_t pin,
|
||||
* 11 Reserved
|
||||
*/
|
||||
|
||||
gpio_pinset_t edges = cfgset & GPIO_INT_MASK;
|
||||
gpio_pinset_t edges = (cfgset & GPIO_INT_MASK);
|
||||
|
||||
if (edges == GPIO_INT_RISING)
|
||||
{
|
||||
@@ -398,16 +398,16 @@ static inline int sam_configperiph(uintptr_t base, uint32_t pin,
|
||||
* 11 Reserved
|
||||
*/
|
||||
|
||||
edges = cfgset & GPIO_INT_MASK;
|
||||
edges = (cfgset & GPIO_INT_MASK);
|
||||
if (edges == GPIO_INT_RISING)
|
||||
{
|
||||
/* Rising only.. disable interrrupts on the falling edge */
|
||||
/* Rising only.. disable interrupts on the falling edge */
|
||||
|
||||
putreg32(pin, base + SAM_GPIO_IMR0S_OFFSET);
|
||||
}
|
||||
else if (edges == GPIO_INT_FALLING)
|
||||
{
|
||||
/* Falling only.. disable interrrupts on the rising edge */
|
||||
/* Falling only.. disable interrupts on the rising edge */
|
||||
|
||||
putreg32(pin, base + SAM_GPIO_IMR1S_OFFSET);
|
||||
}
|
||||
|
||||
@@ -109,12 +109,10 @@ int stm32_dumpgpio(uint32_t pinset, const char *msg)
|
||||
irqstate_t flags;
|
||||
uint32_t base;
|
||||
unsigned int port;
|
||||
unsigned int pin;
|
||||
|
||||
/* Get the base address associated with the GPIO port */
|
||||
|
||||
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
||||
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
|
||||
base = g_gpiobase[port];
|
||||
|
||||
/* The following requires exclusive access to the GPIO registers */
|
||||
|
||||
@@ -753,8 +753,10 @@ static int up_interrupt(int irq, void *context)
|
||||
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
|
||||
struct inode *inode = filep->f_inode;
|
||||
struct uart_dev_s *dev = inode->i_private;
|
||||
#endif
|
||||
int ret = OK;
|
||||
|
||||
switch (cmd)
|
||||
|
||||
@@ -82,7 +82,10 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb)
|
||||
{
|
||||
FAR uint8_t *ptr;
|
||||
size_t mark;
|
||||
int i, j;
|
||||
#if 0
|
||||
int i;
|
||||
int j;
|
||||
#endif
|
||||
|
||||
/* The AVR uses a push-down stack: the stack grows toward lower addresses
|
||||
* in memory. We need to start at the lowest address in the stack memory
|
||||
@@ -121,8 +124,10 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb)
|
||||
{
|
||||
ch = 'X';
|
||||
}
|
||||
|
||||
up_putc(ch);
|
||||
}
|
||||
|
||||
up_putc('\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ static void emac_receive(FAR struct emac_driver_s *priv)
|
||||
}
|
||||
}
|
||||
}
|
||||
while (); /* While there are more packets to be processed */
|
||||
while (true); /* While there are more packets to be processed */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -534,7 +534,7 @@ static int up_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
{
|
||||
FAR struct inode *inode;
|
||||
FAR struct up_dev_s *priv;
|
||||
int ret = OK;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ivdbg("setup: %d\n", (int)setup);
|
||||
|
||||
@@ -302,8 +302,7 @@ static uint8_t z16f_disableuartirq(struct uart_dev_s *dev)
|
||||
|
||||
static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state)
|
||||
{
|
||||
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
|
||||
irqstate_t flags = irqsave();
|
||||
irqstate_t flags = irqsave();
|
||||
|
||||
z16f_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
||||
z16f_rxint(dev, (state & STATE_RXENABLED) ? true : false);
|
||||
@@ -400,7 +399,6 @@ static int z16f_setup(struct uart_dev_s *dev)
|
||||
|
||||
static void z16f_shutdown(struct uart_dev_s *dev)
|
||||
{
|
||||
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
|
||||
(void)z16f_disableuartirq(dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -393,7 +393,6 @@ static void i2c_stop(void)
|
||||
static int i2c_sendaddr(struct ez80_i2cdev_s *priv, uint8_t readbit)
|
||||
{
|
||||
uint8_t sr;
|
||||
int ret = OK;
|
||||
|
||||
/* Wait for the IFLG bit to transition to 1. At this point, we should
|
||||
* have status == 8 meaning that the start bit was sent successfully.
|
||||
|
||||
@@ -284,7 +284,7 @@ static uint8_t spi_waitspif(void)
|
||||
* Name: spi_transfer
|
||||
*
|
||||
* Description:
|
||||
* Send one byte on SPI, return th response
|
||||
* Send one byte on SPI, return the response
|
||||
*
|
||||
* Input Parameters:
|
||||
* ch - the byte to send
|
||||
@@ -361,7 +361,7 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
||||
FAR const uint8_t *ptr = (FAR const uint8_t*)buffer;
|
||||
uint8_t response;
|
||||
|
||||
/* Loop while thre are bytes remaining to be sent */
|
||||
/* Loop while there are bytes remaining to be sent */
|
||||
|
||||
while (buflen-- > 0)
|
||||
{
|
||||
@@ -392,7 +392,6 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
||||
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
|
||||
{
|
||||
FAR uint8_t *ptr = (FAR uint8_t*)buffer;
|
||||
uint8_t response;
|
||||
|
||||
/* Loop while thre are bytes remaining to be sent */
|
||||
|
||||
|
||||
@@ -438,7 +438,6 @@ int up_addrenv_destroy(task_addrenv_t addrenv)
|
||||
int up_addrenv_assign(task_addrenv_t addrenv, FAR struct tcb_s *tcb)
|
||||
{
|
||||
FAR struct z180_cbr_s *cbr = (FAR struct z180_cbr_s *)addrenv;
|
||||
int ret;
|
||||
|
||||
/* Make sure that there is no address environment in place on this TCB */
|
||||
|
||||
|
||||
@@ -284,8 +284,7 @@ static uint8_t z8_disableuartirq(FAR struct uart_dev_s *dev)
|
||||
|
||||
static void z8_restoreuartirq(FAR struct uart_dev_s *dev, uint8_t state)
|
||||
{
|
||||
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
|
||||
irqstate_t flags = irqsave();
|
||||
irqstate_t flags = irqsave();
|
||||
|
||||
z8_txint(dev, (state & STATE_TXENABLED) ? true : false);
|
||||
z8_rxint(dev, (state & STATE_RXENABLED) ? true : false);
|
||||
@@ -322,8 +321,7 @@ static void z8_consoleput(uint8_t ch)
|
||||
|
||||
void z8_uartconfigure(void)
|
||||
{
|
||||
uint16_t brg;
|
||||
uint8_t val;
|
||||
uint8_t val;
|
||||
|
||||
/* Configure GPIO Port A pins 4 & 5 for alternate function */
|
||||
|
||||
@@ -421,7 +419,6 @@ static int z8_setup(FAR struct uart_dev_s *dev)
|
||||
|
||||
static void z8_shutdown(FAR struct uart_dev_s *dev)
|
||||
{
|
||||
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
|
||||
(void)z8_disableuartirq(dev);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user