Skip to content

Commit

Permalink
drivers: gpio_cmsdk_ahb: Fix erronous if statements
Browse files Browse the repository at this point in the history
The GPIO_INT_LEVEL and GPIO_INT_ACTIVE_LOW values are  zero so the
statements are never executed then is better use the bit complement
masks

This issue was reported by Coverity

Coverity-CID: 157586

Change-Id: Ic8b20660a991dd3d0c71248f84c917e5ce5c3c7c
Signed-off-by: Sergio Rodriguez <[email protected]>
  • Loading branch information
srodrig1 authored and Anas Nashif committed Dec 21, 2016
1 parent 814534b commit b520807
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/gpio/gpio_cmsdk_ahb.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ static void cmsdk_ahb_gpio_config(struct device *dev, uint32_t mask, int flags)
*/
if (flags & GPIO_INT_EDGE) {
cfg->port->inttypeclr = mask;
} else if (flags & GPIO_INT_LEVEL) {
} else {
cfg->port->inttypeset = mask;
}
/*
* Interrupt polarity:
* 0 - Low level or falling edge
* 1 - High level or rising edge
*/
if (flags & GPIO_INT_ACTIVE_LOW) {
cfg->port->intpolclr = mask;
} else if (flags & GPIO_INT_ACTIVE_HIGH) {
if (flags & GPIO_INT_ACTIVE_HIGH) {
cfg->port->intpolset = mask;
} else {
cfg->port->intpolclr = mask;
}
}
}
Expand Down

0 comments on commit b520807

Please sign in to comment.