Fix more issues detected by cppcheck

This commit is contained in:
Gregory Nutt 2014-11-25 14:25:02 -06:00
parent 076d20f9c0
commit 2ab604f74f
2 changed files with 24 additions and 25 deletions

View File

@ -81,37 +81,34 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/* /* Used by CC3000 driver to read status of WIFI_IRQ */
* Used by CC3000 driver to read status of WIFI_IRQ
*/
inline long ReadWlanInterruptPin(void) inline long ReadWlanInterruptPin(void)
{ {
// Return the status of WIFI_IRQ pin /* Return the status of WIFI_IRQ pin */
return kl_gpioread(GPIO_WIFI_IRQ);
return kl_gpioread(GPIO_WIFI_IRQ);
} }
/* /* Enable/Disable WiFi */
* Enable/Disable WiFi
*/
void WriteWlanEnablePin(uint8_t val) void WriteWlanEnablePin(uint8_t val)
{ {
kl_gpiowrite(GPIO_WIFI_EN, val); kl_gpiowrite(GPIO_WIFI_EN, val);
} }
/* /* Assert CC3000 CS */
* Assert CC3000 CS
*/
void AssertWlanCS(void) void AssertWlanCS(void)
{ {
kl_gpiowrite(GPIO_WIFI_CS, false); kl_gpiowrite(GPIO_WIFI_CS, false);
} }
/* /* Deassert CC3000 CS */
* Deassert CC3000 CS
*/
void DeassertWlanCS(void) void DeassertWlanCS(void)
{ {
kl_gpiowrite(GPIO_WIFI_CS, true); kl_gpiowrite(GPIO_WIFI_CS, true);
} }
/**************************************************************************** /****************************************************************************
@ -130,21 +127,27 @@ void Wlan_Setup(void)
printf("\nExecuting kl_irq_initialize!\n"); printf("\nExecuting kl_irq_initialize!\n");
/* Configure the PIN used to enable the chip */ /* Configure the PIN used to enable the chip */
kl_configgpio(GPIO_WIFI_EN); kl_configgpio(GPIO_WIFI_EN);
/* Configure PIN to detect interrupts */ /* Configure PIN to detect interrupts */
kl_configgpio(GPIO_WIFI_IRQ); kl_configgpio(GPIO_WIFI_IRQ);
/* Configure PIN used as SPI CS */ /* Configure PIN used as SPI CS */
kl_configgpio(GPIO_WIFI_CS); kl_configgpio(GPIO_WIFI_CS);
/* Make sure the chip is OFF before we start */ /* Make sure the chip is OFF before we start */
WriteWlanEnablePin(false); WriteWlanEnablePin(false);
/* Make sure the SPI CS pin is deasserted */ /* Make sure the SPI CS pin is deasserted */
DeassertWlanCS(); DeassertWlanCS();
/* Configure pin to detect interrupt on falling edge */ /* Configure pin to detect interrupt on falling edge */
regval = getreg32(KL_PORTA_PCR16); regval = getreg32(KL_PORTA_PCR16);
regval |= PORT_PCR_IRQC_FALLING; regval |= PORT_PCR_IRQC_FALLING;
putreg32(regval, KL_PORTA_PCR16); putreg32(regval, KL_PORTA_PCR16);
@ -152,8 +155,6 @@ void Wlan_Setup(void)
ret = irq_attach(KL_IRQ_PORTA, CC3000InterruptHandler); ret = irq_attach(KL_IRQ_PORTA, CC3000InterruptHandler);
if (ret == OK) if (ret == OK)
{ {
up_enable_irq(KL_IRQ_PORTA); up_enable_irq(KL_IRQ_PORTA);
} }
} }

View File

@ -526,10 +526,8 @@ static inline void pg_fillcomplete(void)
int pg_worker(int argc, char *argv[]) int pg_worker(int argc, char *argv[])
{ {
irqstate_t flags; /* Loop forever -- Notice that interrupts will be disabled at all times that
* this thread runs. That is so that we can't lose signals or have
/* Loop forever -- Notice that interrupts will be disable at all times that
* this thread runs. That is so that we con't lose signals or have
* asynchronous page faults. * asynchronous page faults.
* *
* All interrupt logic as well as all page fill worker thread logic must * All interrupt logic as well as all page fill worker thread logic must
@ -539,7 +537,7 @@ int pg_worker(int argc, char *argv[])
*/ */
pglldbg("Started\n"); pglldbg("Started\n");
flags = irqsave(); (void)irqsave();
for (;;) for (;;)
{ {
/* Wait awhile. We will wait here until either the configurable timeout /* Wait awhile. We will wait here until either the configurable timeout