mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] state: bucket_cached: Fix reading pages which need cleanup
@ 2017-03-23 13:21 Sascha Hauer
  2017-03-23 13:21 ` [PATCH 2/2] state: bucket_circular: -EUCLEAN means data could be read Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2017-03-23 13:21 UTC (permalink / raw)
  To: Barebox List

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] state: bucket_circular: -EUCLEAN means data could be read
  2017-03-23 13:21 [PATCH 1/2] state: bucket_cached: Fix reading pages which need cleanup Sascha Hauer
@ 2017-03-23 13:21 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2017-03-23 13:21 UTC (permalink / raw)
  To: Barebox List

-EUCLEAN returned from state_mtd_peb_read() means that the
data shall still be used. This fixes initialization of buckets
which need cleanup

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/state/backend_bucket_circular.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index d8504e035c..9cb9dce2ac 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -390,7 +390,7 @@ static int state_backend_bucket_circular_init(
 
 		ret = state_mtd_peb_read(circ, buf, sub_offset,
 					 circ->writesize);
-		if (ret)
+		if (ret && ret != -EUCLEAN)
 			return ret;
 
 		ret = mtd_buf_all_ff(buf, circ->writesize);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-23 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 13:21 [PATCH 1/2] state: bucket_cached: Fix reading pages which need cleanup Sascha Hauer
2017-03-23 13:21 ` [PATCH 2/2] state: bucket_circular: -EUCLEAN means data could be read Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox