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 poll on init

The while condition for polling the chip ID is broken, it will always
poll for the max ammount of retries.

Change the condition from `or` to `and` to fix the logic.

fixes #15894
This commit is contained in:
Benjamin Valentin 2021-02-11 22:49:42 +01:00
parent 2991466cdd
commit c1348c80a0

View File

@ -393,7 +393,7 @@ static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
xtimer_usleep(dev->params->wait_chip_wake_up);
res = mtd_spi_read_jedec_id(dev, &dev->jedec_id);
retries++;
} while (res < 0 || retries < MTD_POWER_UP_WAIT_FOR_ID);
} while (res < 0 && retries < MTD_POWER_UP_WAIT_FOR_ID);
if (res < 0) {
return -EIO;
}