Skip to content

Commit

Permalink
drivers/periph_common/flashpage: fix silent error
Browse files Browse the repository at this point in the history
This patch removes a test that silently hides failed writes to NULL.
Instead, assert is used to ensure that the address is not NULL.
  • Loading branch information
Enoch247 committed Jan 19, 2023
1 parent e248f95 commit bbe9103
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/periph_common/flashpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ int flashpage_write_and_verify(unsigned page, const void *data)
void flashpage_write_page(unsigned page, const void *data)
{
assert((unsigned) page < FLASHPAGE_NUMOF);
assert(data != NULL);

flashpage_erase(page);

/* write page */
if (data != NULL) {
flashpage_write(flashpage_addr(page), data, FLASHPAGE_SIZE);
}
flashpage_write(flashpage_addr(page), data, FLASHPAGE_SIZE);
}
#endif

Expand Down

0 comments on commit bbe9103

Please # to comment.