tito97sp commented on code in PR #7258: URL: https://github.com/apache/incubator-nuttx/pull/7258#discussion_r990780304
########## arch/arm/src/stm32h7/stm32_flash.c: ########## @@ -330,15 +331,24 @@ static inline uint32_t stm32h7_flash_size( static inline struct stm32h7_flash_priv_s * stm32h7_flash_bank(size_t address) { - struct stm32h7_flash_priv_s *priv = &stm32h7_flash_bank1_priv; - if (address < priv->base || address >= - priv->base + stm32h7_flash_size(priv)) + struct stm32h7_flash_priv_s *priv = NULL; + + uint32_t bank_size; +#ifdef STM32_DUAL_BANK + bank_size = stm32h7_flash_size(priv) / 2; +#else + bank_size = stm32h7_flash_size(priv); +#endif + + if (address >= stm32h7_flash_bank1_priv.base && address < + stm32h7_flash_bank1_priv.base + bank_size) { - return NULL; + priv = &stm32h7_flash_bank1_priv; } -#if STM32_FLASH_NBLOCKS > 1 - if (address >= stm32h7_flash_bank2_priv.base) +#ifdef STM32_DUAL_BANK + else if (address >= stm32h7_flash_bank2_priv.base && address < + stm32h7_flash_bank2_priv.base + bank_size) Review Comment: Fixed :+1: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org