diff --git a/pkg/spiffs/fs/spiffs_fs.c b/pkg/spiffs/fs/spiffs_fs.c index 33f37fb49f68..17244bd2a6c8 100644 --- a/pkg/spiffs/fs/spiffs_fs.c +++ b/pkg/spiffs/fs/spiffs_fs.c @@ -14,7 +14,7 @@ #include "kernel_defines.h" -#define ENABLE_DEBUG (0) +#define ENABLE_DEBUG (1) #include static int spiffs_err_to_errno(s32_t err); @@ -26,7 +26,12 @@ static int32_t _dev_read(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *dst) //DEBUG("spiffs: read: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size); - return mtd_read(dev, dst, addr, size); + if (mtd_read(dev, dst, addr, size) > 0) { + return 0; + } + else { + return -EIO; + } } static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src) @@ -35,7 +40,12 @@ static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src DEBUG("spiffs: write: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size); - return mtd_write(dev, src, addr, size); + if (mtd_write(dev, src, addr, size) > 0) { + return 0; + } + else { + return -EIO; + } } static int32_t _dev_erase(struct spiffs_t *fs, u32_t addr, u32_t size)