drivers/flash: stm32h7: fix fault when cache disabled
Add a check to avoid invalidating the cache when the latter is disabled. Indeed, doing so can lead to a bus fault. Signed-off-by: Thomas Altenbach <taltenbach@witekio.com>
This commit is contained in:
parent
f2d80c1b11
commit
c5ebea590f
1 changed files with 5 additions and 0 deletions
|
@ -449,6 +449,11 @@ static void flash_stm32h7_flush_caches(const struct device *dev,
|
|||
off_t offset, size_t len)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
if (!(SCB->CCR & SCB_CCR_DC_Msk)) {
|
||||
return; /* Cache not enabled */
|
||||
}
|
||||
|
||||
SCB_InvalidateDCache_by_Addr((uint32_t *)(CONFIG_FLASH_BASE_ADDRESS
|
||||
+ offset), len);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue