soc: arm: Make statements evaluate boolean expressions
MISRA-C requires that the if statement has essentially Boolean type. MISRA-C rule 14.4 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
353933125f
commit
359adfc959
9 changed files with 20 additions and 20 deletions
|
@ -133,11 +133,11 @@ static int imxrt_init(struct device *arg)
|
|||
oldLevel = irq_lock();
|
||||
|
||||
/* Watchdog disable */
|
||||
if (WDOG1->WCR & WDOG_WCR_WDE_MASK) {
|
||||
if ((WDOG1->WCR & WDOG_WCR_WDE_MASK) != 0) {
|
||||
WDOG1->WCR &= ~WDOG_WCR_WDE_MASK;
|
||||
}
|
||||
|
||||
if (WDOG2->WCR & WDOG_WCR_WDE_MASK) {
|
||||
if ((WDOG2->WCR & WDOG_WCR_WDE_MASK) != 0) {
|
||||
WDOG2->WCR &= ~WDOG_WCR_WDE_MASK;
|
||||
}
|
||||
|
||||
|
@ -147,12 +147,12 @@ static int imxrt_init(struct device *arg)
|
|||
| RTWDOG_CS_UPDATE_MASK;
|
||||
|
||||
/* Disable Systick which might be enabled by bootrom */
|
||||
if (SysTick->CTRL & SysTick_CTRL_ENABLE_Msk) {
|
||||
if ((SysTick->CTRL & SysTick_CTRL_ENABLE_Msk) != 0) {
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
|
||||
SCB_EnableICache();
|
||||
if (!(SCB->CCR & SCB_CCR_DC_Msk)) {
|
||||
if ((SCB->CCR & SCB_CCR_DC_Msk) == 0) {
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
|
@ -29,7 +29,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
{
|
||||
int direction = flags & GPIO_DIR_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
|
@ -27,7 +27,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
|
@ -28,7 +28,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
|
@ -28,7 +28,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
{
|
||||
struct stm32f4x_gpio *gpio = (struct stm32f4x_gpio *)base;
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
/* atomic set */
|
||||
gpio->bsr = (1 << (pin & 0x0f));
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
{
|
||||
struct stm32f7x_gpio *gpio = (struct stm32f7x_gpio *)base;
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
/* atomic set */
|
||||
gpio->bsrr = (1 << (pin & 0x0f));
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
|
@ -54,7 +54,7 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int direction = flags & GPIO_DIR_MASK;
|
||||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (!pincfg) {
|
||||
if (pincfg == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ int stm32_gpio_set(u32_t *base, int pin, int value)
|
|||
struct stm32l4x_gpio *gpio = (struct stm32l4x_gpio *)base;
|
||||
int pval = 1 << (pin & 0xf);
|
||||
|
||||
if (value) {
|
||||
if (value != 0) {
|
||||
gpio->odr |= pval;
|
||||
} else {
|
||||
gpio->odr &= ~pval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue