summaryrefslogtreecommitdiffstats
path: root/src/barebox-state/backend_storage.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-23 09:16:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 13:57:47 +0200
commit3194079a41bbed718ca758567affe486904c7139 (patch)
tree6cb9ca396bfcb11d792c5b567a6695eb4da563fd /src/barebox-state/backend_storage.c
parente790822a6676ef3672f1037f1304904d0d36fbff (diff)
downloaddt-utils-3194079a41bbed718ca758567affe486904c7139.tar.gz
dt-utils-3194079a41bbed718ca758567affe486904c7139.tar.xz
state: replace len_hint logic
The len_hint mechanism is rather hard to understand as it's not clear from where to where the hint is passed and also it's not clear what happens if the hint is empty or wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'src/barebox-state/backend_storage.c')
-rw-r--r--src/barebox-state/backend_storage.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/barebox-state/backend_storage.c b/src/barebox-state/backend_storage.c
index c6a3e44..ef40a8f 100644
--- a/src/barebox-state/backend_storage.c
+++ b/src/barebox-state/backend_storage.c
@@ -112,15 +112,18 @@ int state_storage_read(struct state_backend_storage *storage,
int ret;
list_for_each_entry(bucket, &storage->buckets, bucket_list) {
- *len = 0;
-
ret = bucket->read(bucket, buf, len);
if (ret) {
dev_warn(storage->dev, "Failed to read from state backend bucket, trying next, %d\n",
ret);
continue;
}
- ret = format->verify(format, magic, *buf, *len);
+
+ /*
+ * Verify the buffer crcs. The buffer length is passed in the len argument,
+ * .verify overwrites it with the length actually used.
+ */
+ ret = format->verify(format, magic, *buf, len);
if (!ret) {
goto found;
}