Skip to content

Commit

Permalink
esp32/machine_sdcard: Fix invalid result of SDCard.read/writeblocks.
Browse files Browse the repository at this point in the history
Functions would return NULL instead of `mp_const_false` if failed to init.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
  • Loading branch information
projectgus authored and dpgeorge committed Feb 12, 2025
1 parent 1a67d72 commit b675c87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ports/esp32/machine_sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,

err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
if (err != ESP_OK) {
return false;
return mp_const_false;
}

mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
Expand All @@ -381,7 +381,7 @@ static mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,

err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
if (err != ESP_OK) {
return false;
return mp_const_false;
}

mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
Expand Down

0 comments on commit b675c87

Please sign in to comment.