summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 14:25:02 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 14:25:02 -0600
commitf7de6bbcbae818aff936bd71ee5268946ea9ad30 (patch)
treeff13b10223e94f6902d1629dcb1a95794b5c92cd
parentd23e7ede0acfc2f853e6f9416a72fa5fa01a4c42 (diff)
downloadnuttx-f7de6bbcbae818aff936bd71ee5268946ea9ad30.tar.gz
nuttx-f7de6bbcbae818aff936bd71ee5268946ea9ad30.tar.bz2
nuttx-f7de6bbcbae818aff936bd71ee5268946ea9ad30.zip
Fix more issues detected by cppcheck
-rw-r--r--nuttx/configs/freedom-kl25z/src/kl_wifi.c41
-rw-r--r--nuttx/sched/paging/pg_worker.c8
2 files changed, 24 insertions, 25 deletions
diff --git a/nuttx/configs/freedom-kl25z/src/kl_wifi.c b/nuttx/configs/freedom-kl25z/src/kl_wifi.c
index 42732a590..b72d73942 100644
--- a/nuttx/configs/freedom-kl25z/src/kl_wifi.c
+++ b/nuttx/configs/freedom-kl25z/src/kl_wifi.c
@@ -81,37 +81,34 @@
* 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)
{
- // Return the status of WIFI_IRQ pin
- return kl_gpioread(GPIO_WIFI_IRQ);
+ /* Return the status of WIFI_IRQ pin */
+
+ return kl_gpioread(GPIO_WIFI_IRQ);
}
-/*
- * Enable/Disable WiFi
- */
+/* Enable/Disable WiFi */
+
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)
{
- kl_gpiowrite(GPIO_WIFI_CS, false);
+ kl_gpiowrite(GPIO_WIFI_CS, false);
}
-/*
- * Deassert CC3000 CS
- */
+/* Deassert CC3000 CS */
+
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");
/* Configure the PIN used to enable the chip */
+
kl_configgpio(GPIO_WIFI_EN);
/* Configure PIN to detect interrupts */
+
kl_configgpio(GPIO_WIFI_IRQ);
/* Configure PIN used as SPI CS */
+
kl_configgpio(GPIO_WIFI_CS);
/* Make sure the chip is OFF before we start */
+
WriteWlanEnablePin(false);
/* Make sure the SPI CS pin is deasserted */
+
DeassertWlanCS();
/* Configure pin to detect interrupt on falling edge */
+
regval = getreg32(KL_PORTA_PCR16);
regval |= PORT_PCR_IRQC_FALLING;
putreg32(regval, KL_PORTA_PCR16);
@@ -152,8 +155,6 @@ void Wlan_Setup(void)
ret = irq_attach(KL_IRQ_PORTA, CC3000InterruptHandler);
if (ret == OK)
{
- up_enable_irq(KL_IRQ_PORTA);
+ up_enable_irq(KL_IRQ_PORTA);
}
-
}
-
diff --git a/nuttx/sched/paging/pg_worker.c b/nuttx/sched/paging/pg_worker.c
index e15320160..1ccc123d3 100644
--- a/nuttx/sched/paging/pg_worker.c
+++ b/nuttx/sched/paging/pg_worker.c
@@ -526,10 +526,8 @@ static inline void pg_fillcomplete(void)
int pg_worker(int argc, char *argv[])
{
- irqstate_t flags;
-
- /* 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
+ /* 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
* asynchronous page faults.
*
* 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");
- flags = irqsave();
+ (void)irqsave();
for (;;)
{
/* Wait awhile. We will wait here until either the configurable timeout