From 82d17f1f2c45d4a06ed734ae59e1955a59d8e38a Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Mon, 29 Jul 2024 16:33:11 +0300 Subject: [PATCH] gpio_smartbond: Remove pdc entry only if it exists Remove pdc entry only if index exists when CONFIG_PM is set. Signed-off-by: Ioannis Damigos --- drivers/gpio/gpio_smartbond.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio_smartbond.c b/drivers/gpio/gpio_smartbond.c index 738f891fb2c..0c04fef7ffd 100644 --- a/drivers/gpio/gpio_smartbond.c +++ b/drivers/gpio/gpio_smartbond.c @@ -242,7 +242,9 @@ static int gpio_smartbond_pin_interrupt_configure(const struct device *dev, config->wkup_regs->clear = pin_mask; data->both_edges_pins &= ~pin_mask; #if CONFIG_PM - da1469x_pdc_del(pdc_ix); + if (pdc_ix >= 0) { + da1469x_pdc_del(pdc_ix); + } #endif } else { if (trig == GPIO_INT_TRIG_BOTH) {