drivers: gpio_cmsdk_ahb: Fix erronous if statements

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 <sergio.sf.rodriguez@intel.com>
This commit is contained in:
Sergio Rodriguez 2016-12-12 11:15:44 -08:00 committed by Anas Nashif
commit b52080749f

View file

@ -82,7 +82,7 @@ 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;
}
/*
@ -90,10 +90,10 @@ static void cmsdk_ahb_gpio_config(struct device *dev, uint32_t mask, int flags)
* 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;
}
}
}