diff --git a/core/drivers/stm32_gpio.c b/core/drivers/stm32_gpio.c index d74c12e32c7..8c2e614b290 100644 --- a/core/drivers/stm32_gpio.c +++ b/core/drivers/stm32_gpio.c @@ -1628,6 +1628,7 @@ static TEE_Result apply_sec_cfg(void) { TEE_Result res = TEE_ERROR_GENERIC; struct stm32_gpio_bank *bank = NULL; + unsigned int pin = 0; STAILQ_FOREACH(bank, &bank_list, link) { if (bank->ready) @@ -1644,6 +1645,17 @@ static TEE_Result apply_sec_cfg(void) free(bank); return res; } + + /* + * Semaphores for pinctrl and GPIO are taken when + * these are used (pinctrl state applied, GPIO + * consumed) or when an explicit firewall configuration + * is requested through the firewall framework. + * Therefore release here the taken semaphores. + */ + for (pin = 0; pin < bank->ngpios; pin++) + release_rif_semaphore_if_acquired(bank, pin); + } else { stm32_gpio_set_conf_sec(bank); }