summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-10-22 02:26:48 +0300
committerSimon Glass <sjg@chromium.org>2019-10-27 19:56:51 +0300
commited54bdaf88758854905b5d8ca5036a078b9ef168 (patch)
treebcb33718ed713fe99ff682cf9aeef830c8706523
parent53a4f253f129926bb5398634c8bae43ab788342d (diff)
downloadu-boot-ed54bdaf88758854905b5d8ca5036a078b9ef168.tar.xz
bootstage: Fix counting of entries in stash
The current code searches for empty records but these not existing with bootstage now. This used to be needed when bootstage records were stored in a spare array. Drop the unnecessary code and fix a code-style nit at the same time. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/bootstage.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/common/bootstage.c b/common/bootstage.c
index 257dc5d402..fe36bac047 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -373,7 +373,6 @@ int bootstage_stash(void *base, int size)
const struct bootstage_record *rec;
char buf[20];
char *ptr = base, *end = ptr + size;
- uint32_t count;
int i;
if (hdr + 1 > (struct bootstage_hdr *)end) {
@@ -384,22 +383,15 @@ int bootstage_stash(void *base, int size)
/* Write an arbitrary version number */
hdr->version = BOOTSTAGE_VERSION;
- /* Count the number of records, and write that value first */
- for (rec = data->record, i = count = 0; i < data->rec_count;
- i++, rec++) {
- if (rec->id != 0)
- count++;
- }
- hdr->count = count;
+ hdr->count = data->rec_count;
hdr->size = 0;
hdr->magic = BOOTSTAGE_MAGIC;
hdr->next_id = data->next_id;
ptr += sizeof(*hdr);
/* Write the records, silently stopping when we run out of space */
- for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {
+ for (rec = data->record, i = 0; i < data->rec_count; i++, rec++)
append_data(&ptr, end, rec, sizeof(*rec));
- }
/* Write the name strings */
for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {