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

drivers/mtd_flashpage: narrow down FLASHPAGE_WRITE_BLOCK_ALIGNMENT check

Only check the *write* block alignment, not the *read* or *source* alignment.
This commit is contained in:
Benjamin Valentin 2021-02-16 18:16:16 +01:00
parent 4291df0305
commit 1ca93e0171

View File

@ -42,10 +42,6 @@ static int _read(mtd_dev_t *dev, void *buf, uint32_t addr, uint32_t size)
(void)dev;
if (addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
return -EINVAL;
}
#if (__SIZEOF_POINTER__ == 2)
uint16_t dst_addr = addr;
#else
@ -64,9 +60,6 @@ static int _write(mtd_dev_t *dev, const void *buf, uint32_t addr, uint32_t size)
if (addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
return -EINVAL;
}
if ((uintptr_t)buf % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
return -EINVAL;
}
if (size % FLASHPAGE_WRITE_BLOCK_SIZE) {
return -EOVERFLOW;
}