[bsp][stm32] fix variable init

fix https://github.com/RT-Thread/rt-thread/pull/9525
This commit is contained in:
Meco Man 2024-10-14 21:30:55 -04:00
parent 8c1cd39d80
commit 47d941388b
1 changed files with 2 additions and 1 deletions

View File

@ -402,6 +402,8 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
if (enabled == PIN_IRQ_ENABLE)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
irqindex = bit2bitno(PIN_STPIN(pin));
if (irqindex < 0 || irqindex >= (rt_int32_t)ITEM_NUM(pin_irq_map))
{
@ -417,7 +419,6 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
}
irqmap = &pin_irq_map[irqindex];
GPIO_InitTypeDef GPIO_InitStruct;
/* Configure GPIO_InitStructure */
GPIO_InitStruct.Pin = PIN_STPIN(pin);