diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2021-11-29 08:22:35 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-01-10 12:09:29 +0100 |
commit | 818d180da1c709f3d2789925662222019b3cf439 (patch) | |
tree | b40ccd1d64d7b9a49b75c03c06418fd27450e13f /common | |
parent | c84e7dbc79bda2b62e74a5265e2be1fd2604e02b (diff) | |
download | barebox-818d180da1c709f3d2789925662222019b3cf439.tar.gz barebox-818d180da1c709f3d2789925662222019b3cf439.tar.xz |
state: make first boot with uninitialized legacy state less verbose
With non-legacy state, barebox checks a header for a specific magic
signature. This can be all zero on an uninitialized state, so in that
particular case, bump down the log message severity.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20211129072235.2016324-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/state/backend_bucket_direct.c | 4 | ||||
-rw-r--r-- | common/state/backend_storage.c | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c index 517aec6063..117cdfb46c 100644 --- a/common/state/backend_bucket_direct.c +++ b/common/state/backend_bucket_direct.c @@ -76,9 +76,9 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket if (meta.magic != ~0 && !!meta.magic) bucket->wrong_magic = 1; if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) { - dev_err(direct->dev, "No meta data header found\n"); dev_dbg(direct->dev, "Enable backward compatibility or increase stride size\n"); - return -EINVAL; + return dev_err_state_init(direct->dev, meta.magic ? -EINVAL : -ENOMEDIUM, + "No meta data header found\n"); } read_len = direct->max_size; if (lseek(direct->fd, direct->offset, SEEK_SET) != diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index 72f8bcf521..c55d22e37f 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -156,10 +156,13 @@ int state_storage_read(struct state_backend_storage *storage, totalbuckets++; ret = bucket->read(bucket, &bucket->buf, &bucket->len); - if (ret == -EUCLEAN) + if (ret == -EUCLEAN) { bucket->needs_refresh = 1; - else if (ret) + } else if (ret) { + if (ret == -ENOMEDIUM) + zerobuckets++; continue; + } /* * Verify the buffer crcs. The buffer length is passed in the len argument, |