Skip to content

Fix propagation of error code in LITTLEFS_read()/LITTLEFS_write()#26

Open
fwolter wants to merge 7 commits into
Microchip-MPLAB-Harmony:masterfrom
fwolter:master
Open

Fix propagation of error code in LITTLEFS_read()/LITTLEFS_write()#26
fwolter wants to merge 7 commits into
Microchip-MPLAB-Harmony:masterfrom
fwolter:master

Conversation

@fwolter

@fwolter fwolter commented May 5, 2022

Copy link
Copy Markdown

The comparison if (*bw < 0) in LITTLEFS_write(..) will always yield false, because *bw is an unsigned pointer. Same for the read function.
This yields to SYS_FS_FileError(..) returning a no-error state when LITTLEFS_read()/LITTLEFS_write() have been failed.

This also fixes the missing mapping from the LittleFS error code to the Harmony error code in LITTLEFS_read().

fwolter added 7 commits May 5, 2022 10:55
The bytes-written argument must be signed, otherwise the check "if (*bw < 0)" will always yield false and the error code isn't available with SYS_FS_FileError(..).
@fwolter fwolter changed the title Fix propagation of error code in LITTLEFS_write() Fix propagation of error code in LITTLEFS_read()/LITTLEFS_write() May 5, 2022
@vishalnxt

Copy link
Copy Markdown
Collaborator

@fwolter , thank you for reporting the issue and suggesting the fix as well. This will be fixed in the next release of core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants