Skip to content

Commit 37c39d0

Browse files
committed
drivers/mtd_flashpage: improve _write_page
1 parent 4370d93 commit 37c39d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mtd_flashpage/mtd_flashpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ static int _write_page(mtd_dev_t *dev, const void *buf, uint32_t page, uint32_t
114114
__attribute__ ((aligned (FLASHPAGE_WRITE_BLOCK_ALIGNMENT)));
115115

116116
offset = addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT;
117-
size = MIN(size, FLASHPAGE_WRITE_BLOCK_ALIGNMENT - offset);
117+
size = MIN(size, FLASHPAGE_WRITE_BLOCK_SIZE - offset);
118118

119-
DEBUG("flashpage: write %"PRIu32" unaligned bytes\n", size);
119+
DEBUG("flashpage: write %"PRIu32" at %p - ""%"PRIu32"\n", size, (void *)addr, offset);
120120

121121
memcpy(&tmp[0], (uint8_t *)addr - offset, sizeof(tmp));
122122
memcpy(&tmp[offset], buf, size);

0 commit comments

Comments
 (0)