[PATCH] state: backend_storage: Set needs_refresh back to 0 after refreshing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux