summaryrefslogtreecommitdiffstats
path: root/common/state/backend_storage.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-04-19 10:18:42 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-19 10:18:44 +0200
commit275f35461a454be350ca18a25042be8800ac5008 (patch)
treed34b946f7bab1118d20f5b4af01180c177ebbd9b /common/state/backend_storage.c
parentaf187108cf33826fd3ff2be4469563ae4169fe48 (diff)
downloadbarebox-275f35461a454be350ca18a25042be8800ac5008.tar.gz
barebox-275f35461a454be350ca18a25042be8800ac5008.tar.xz
state: backend_storage: Set needs_refresh back to 0 after refreshing
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>
Diffstat (limited to 'common/state/backend_storage.c')
-rw-r--r--common/state/backend_storage.c6
1 files 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;
}