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

drivers/mtd_spi_nor: fix off by one bug

The boolean expression to detect when 32 bit address mode are needed
was off by one, this fixes the issue.
This commit is contained in:
Marian Buschsieweke 2022-04-13 17:24:39 +02:00
parent 32ac29bd98
commit c2e029b427
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -482,7 +482,7 @@ static void _set_addr_width(mtd_dev_t *mtd)
uint32_t flash_size = mtd->pages_per_sector * mtd->page_size
* mtd->sector_count;
if (flash_size > 0xFFFFFF) {
if (flash_size > (0x1UL << 24)) {
dev->addr_width = 4;
} else {
dev->addr_width = 3;