diff --git a/core/drivers/stm32_gpio.c b/core/drivers/stm32_gpio.c index 64ca2e54457..52a7d3b1d11 100644 --- a/core/drivers/stm32_gpio.c +++ b/core/drivers/stm32_gpio.c @@ -1291,6 +1291,13 @@ static TEE_Result stm32_pinctrl_conf_apply(struct pinconf *conf) for (n = 0; n < pin_count; n++) { struct stm32_gpio_bank *bank = stm32_gpio_get_bank(p[n].bank); + if (!pin_is_accessible(bank, p[n].pin)) { + EMSG("Apply pinctrl for pin %c%u that cannot be accessed", + p[n].bank + 'A', p[n].pin); + error = true; + continue; + } + if (p[n].cfg.nsec == !pin_is_secure(bank, p[n].pin)) continue; @@ -1309,7 +1316,7 @@ static TEE_Result stm32_pinctrl_conf_apply(struct pinconf *conf) } if (error) - return TEE_ERROR_GENERIC; + return TEE_ERROR_SECURITY; for (n = 0; n < pin_count; n++) set_gpio_cfg(p[n].bank, p[n].pin, &p[n].cfg);