mirror of
https://github.com/apache/nuttx.git
synced 2026-09-20 04:47:58 +08:00
drivers/bch: Handle return value of bchlib_readsector()
This commit is contained in:
committed by
Xiang Xiao
parent
59b9a30592
commit
9d29d4bef5
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user