1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd_flashpage: fix comperror when compiling without asserts

the variable cpu_flash_base is only used in asserts. This gives errors if you compile without them.
This commit is contained in:
kasper 2024-03-19 14:36:01 +00:00
parent c5710392b2
commit 02d86c2a25

View File

@ -45,8 +45,9 @@ static int _init(mtd_dev_t *dev)
assert(!(super->offset % dev->pages_per_sector));
/* Use separate variable to avoid '>= 0 is always true' warning */
#ifndef NDEBUG
static const uintptr_t cpu_flash_base = CPU_FLASH_BASE;
#endif
assert((uintptr_t)flashpage_addr(super->offset / dev->pages_per_sector) >= cpu_flash_base);
assert((uintptr_t)flashpage_addr(super->offset / dev->pages_per_sector)
+ dev->pages_per_sector * dev->page_size * dev->sector_count <= MTD_FLASHPAGE_END_ADDR);