mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] state: backend_storage: Set needs_refresh back to 0 after refreshing
@ 2017-04-19  8:21 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2017-04-19  8:21 UTC (permalink / raw)
  To: Barebox List

Set needs_refresh back to 0 after refreshing so that we do not refresh
it again without need. This would only happen when we read the state
from the storage multiple times, which normally is not the case.
However, it's more consistent like this.

Reported-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/state/backend_storage.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index 9ed6ad79ac..8d24f7053d 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -110,12 +110,14 @@ static int bucket_refresh(struct state_backend_storage *storage,
 refresh:
 	ret = bucket->write(bucket, buf, len);
 
-	if (ret)
+	if (ret) {
 		dev_warn(storage->dev, "Failed to restore bucket %d@0x%08lx\n",
 			 bucket->num, bucket->offset);
-	else
+	} else {
 		dev_info(storage->dev, "restored bucket %d@0x%08lx\n",
 			 bucket->num, bucket->offset);
+		bucket->needs_refresh = 0;
+	}
 
 	return ret;
 }
-- 
2.11.0


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-19  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19  8:21 [PATCH] state: backend_storage: Set needs_refresh back to 0 after refreshing Sascha Hauer

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