diff --git a/drivers/bch/bchlib_read.c b/drivers/bch/bchlib_read.c index 9010a2171d..7c6b6239a8 100644 --- a/drivers/bch/bchlib_read.c +++ b/drivers/bch/bchlib_read.c @@ -99,7 +99,11 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, { /* Read the sector into the sector buffer */ - bchlib_readsector(bch, sector); + ret = bchlib_readsector(bch, sector); + if (ret < 0) + { + return ret; + } /* Copy the tail end of the sector to the user buffer */ @@ -169,7 +173,11 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, { /* Read the sector into the sector buffer */ - bchlib_readsector(bch, sector); + ret = bchlib_readsector(bch, sector); + if (ret < 0) + { + return ret; + } /* Copy the head end of the sector to the user buffer */ diff --git a/drivers/bch/bchlib_write.c b/drivers/bch/bchlib_write.c index 0540e66f71..8944cae9d7 100644 --- a/drivers/bch/bchlib_write.c +++ b/drivers/bch/bchlib_write.c @@ -84,7 +84,11 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, { /* Read the full sector into the sector buffer */ - bchlib_readsector(bch, sector); + ret = bchlib_readsector(bch, sector); + if (ret < 0) + { + return ret; + } /* Copy the tail end of the sector from the user buffer */ @@ -166,7 +170,11 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, { /* Read the sector into the sector buffer */ - bchlib_readsector(bch, sector); + ret = bchlib_readsector(bch, sector); + if (ret < 0) + { + return ret; + } /* Copy the head end of the sector from the user buffer */