mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] state: backend_storage: Set needs_refresh back to 0 after refreshing
Date: Wed, 19 Apr 2017 10:21:51 +0200	[thread overview]
Message-ID: <20170419082151.21841-1-s.hauer@pengutronix.de> (raw)

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

                 reply	other threads:[~2017-04-19  8:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170419082151.21841-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox