diff --git a/drivers/gpio/gpio_ambiq.c b/drivers/gpio/gpio_ambiq.c index b036094e68..e264a4096d 100644 --- a/drivers/gpio/gpio_ambiq.c +++ b/drivers/gpio/gpio_ambiq.c @@ -279,6 +279,8 @@ static int ambiq_gpio_pin_interrupt_configure(const struct device *dev, gpio_pin * ERR008: GPIO: Dual-edge interrupts are not vectoring */ return -ENOTSUP; + default: + return -EINVAL; } ret = am_hal_gpio_pinconfig(gpio_pin, pincfg); diff --git a/drivers/gpio/gpio_eos_s3.c b/drivers/gpio/gpio_eos_s3.c index 9ad94fe07d..525b5e52c7 100644 --- a/drivers/gpio/gpio_eos_s3.c +++ b/drivers/gpio/gpio_eos_s3.c @@ -311,6 +311,8 @@ static int gpio_eos_s3_pin_interrupt_configure(const struct device *dev, break; case GPIO_INT_TRIG_BOTH: return -ENOTSUP; + default: + return -EINVAL; } } diff --git a/drivers/gpio/gpio_mcp23xxx.c b/drivers/gpio/gpio_mcp23xxx.c index c9cb32866b..1e6af8f7a7 100644 --- a/drivers/gpio/gpio_mcp23xxx.c +++ b/drivers/gpio/gpio_mcp23xxx.c @@ -323,6 +323,9 @@ static int mcp23xxx_pin_interrupt_configure(const struct device *dev, gpio_pin_t /* can't happen */ ret = -ENOTSUP; goto done; + default: + ret = -EINVAL; + goto done; } break; @@ -343,6 +346,9 @@ static int mcp23xxx_pin_interrupt_configure(const struct device *dev, gpio_pin_t drv_data->rising_edge_ints |= BIT(pin); drv_data->falling_edge_ints |= BIT(pin); break; + default: + ret = -EINVAL; + goto done; } break; } diff --git a/drivers/gpio/gpio_mcux.c b/drivers/gpio/gpio_mcux.c index afa16b198c..6c40460ee6 100644 --- a/drivers/gpio/gpio_mcux.c +++ b/drivers/gpio/gpio_mcux.c @@ -205,6 +205,8 @@ static uint32_t get_port_pcr_irqc_value_from_flags(const struct device *dev, case GPIO_INT_TRIG_BOTH: port_interrupt = kPORT_InterruptEitherEdge; break; + default: + return -EINVAL; } } } diff --git a/drivers/gpio/gpio_numicro.c b/drivers/gpio/gpio_numicro.c index 5044c8d2d2..e97eefd6b8 100644 --- a/drivers/gpio/gpio_numicro.c +++ b/drivers/gpio/gpio_numicro.c @@ -200,6 +200,8 @@ static int gpio_numicro_pin_interrupt_configure(const struct device *dev, case GPIO_INT_TRIG_BOTH: int_level = BIT(pin) | BIT(pin + 16); break; + default: + return -EINVAL; } } diff --git a/drivers/gpio/gpio_psoc6.c b/drivers/gpio/gpio_psoc6.c index 4fd22d30ea..0e56bf7641 100644 --- a/drivers/gpio/gpio_psoc6.c +++ b/drivers/gpio/gpio_psoc6.c @@ -171,6 +171,8 @@ static int gpio_psoc6_pin_interrupt_configure(const struct device *dev, case GPIO_INT_TRIG_LOW: lv_trg = CY_GPIO_INTR_FALLING; break; + default: + return -EINVAL; } } diff --git a/drivers/gpio/gpio_rt1718s_port.c b/drivers/gpio/gpio_rt1718s_port.c index 1686afd017..2a57b63c2f 100644 --- a/drivers/gpio/gpio_rt1718s_port.c +++ b/drivers/gpio/gpio_rt1718s_port.c @@ -255,6 +255,9 @@ static int gpio_rt1718s_pin_interrupt_configure(const struct device *dev, gpio_p case GPIO_INT_TRIG_LOW: new_reg_mask8 = (reg_mask8 | mask_fall) & ~mask_rise; break; + default: + ret = -EINVAL; + goto done; } ret = rt1718s_reg_burst_read(config->rt1718s_dev, RT1718S_REG_ALERT_MASK, diff --git a/drivers/gpio/gpio_rv32m1.c b/drivers/gpio/gpio_rv32m1.c index e6a26b273f..5a27f278a5 100644 --- a/drivers/gpio/gpio_rv32m1.c +++ b/drivers/gpio/gpio_rv32m1.c @@ -64,6 +64,8 @@ static uint32_t get_port_pcr_irqc_value_from_flags(const struct device *dev, case GPIO_INT_TRIG_BOTH: port_interrupt = kPORT_InterruptEitherEdge; break; + default: + return -EINVAL; } } } diff --git a/drivers/gpio/gpio_sedi.c b/drivers/gpio/gpio_sedi.c index 17dfe79f09..806ec422c9 100644 --- a/drivers/gpio/gpio_sedi.c +++ b/drivers/gpio/gpio_sedi.c @@ -244,6 +244,8 @@ static int gpio_sedi_interrupt_configure(const struct device *dev, pin_config.interrupt_mode = SEDI_GPIO_INT_MODE_BOTH_EDGE; break; + default: + return -EINVAL; } } /* Configure interrupt mode */ diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index e2cdb1d532..d835c3454c 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -623,8 +623,6 @@ static int gpio_stm32_pin_interrupt_configure(const struct device *dev, goto exit; } - gpio_stm32_enable_int(cfg->port, pin); - switch (trig) { case GPIO_INT_TRIG_LOW: edge = STM32_EXTI_TRIG_FALLING; @@ -635,8 +633,13 @@ static int gpio_stm32_pin_interrupt_configure(const struct device *dev, case GPIO_INT_TRIG_BOTH: edge = STM32_EXTI_TRIG_BOTH; break; + default: + err = -EINVAL; + goto exit; } + gpio_stm32_enable_int(cfg->port, pin); + stm32_exti_trigger(pin, edge); stm32_exti_enable(pin);