Skip to content

Commit

Permalink
Merge pull request RIOT-OS#20486 from FlapKap/tests/drivers/mtd_flash…
Browse files Browse the repository at this point in the history
…page_assert_error

drivers/mtd_flashpage: fix comperror when compiling without asserts
  • Loading branch information
benpicco authored Mar 19, 2024
2 parents 5242533 + 02d86c2 commit 3ebccd7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mtd_flashpage/mtd_flashpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3ebccd7

Please sign in to comment.