summaryrefslogtreecommitdiff
path: root/extmod/vfs_blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/vfs_blockdev.c')
-rw-r--r--extmod/vfs_blockdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/extmod/vfs_blockdev.c b/extmod/vfs_blockdev.c
index a7c14b76e..d43c96b08 100644
--- a/extmod/vfs_blockdev.c
+++ b/extmod/vfs_blockdev.c
@@ -58,6 +58,13 @@ static int mp_vfs_blockdev_call_rw(mp_obj_t *args, size_t block_num, size_t bloc
if (ret == mp_const_none) {
return 0;
} else {
+ // Some block devices return a bool indicating success, so
+ // convert those to an errno integer code.
+ if (ret == mp_const_true) {
+ return 0;
+ } else if (ret == mp_const_false) {
+ return -MP_EIO;
+ }
// Block device functions are expected to return 0 on success
// and negative integer on errors. Check for positive integer
// results as some callers (i.e. littlefs) will produce corrupt