[PATCH 1/2] state: bucket_cached: Fix reading pages which need cleanup

Sascha Hauer s.hauer at pengutronix.de
Thu Mar 23 06:21:41 PDT 2017


When the raw device returns -EUCLEAN we have to return
successfully to the upper layer, otherwise it will discard the
data.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/state/backend_bucket_cached.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/state/backend_bucket_cached.c b/common/state/backend_bucket_cached.c
index 781ac2debd..ba0af7f373 100644
--- a/common/state/backend_bucket_cached.c
+++ b/common/state/backend_bucket_cached.c
@@ -52,12 +52,12 @@ static int state_backend_bucket_cache_fill(
 	int ret;
 
 	ret = cache->raw->read(cache->raw, &cache->data, &cache->data_len);
-	if (ret == -EUCLEAN)
+	if (ret == -EUCLEAN) {
 		cache->force_write = true;
-	else if (ret)
-		return ret;
+		ret = 0;
+	}
 
-	return 0;
+	return ret;
 }
 
 static int state_backend_bucket_cache_read(struct state_backend_storage_bucket *bucket,
-- 
2.11.0




More information about the barebox mailing list