aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/nvram-format.c3
-rw-r--r--core/nvram.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/core/nvram-format.c b/core/nvram-format.c
index 3d030a3..42c5cbb 100644
--- a/core/nvram-format.c
+++ b/core/nvram-format.c
@@ -180,6 +180,7 @@ int nvram_check(void *nvram_image, const uint32_t nvram_size)
}
prlog(PR_INFO, "NVRAM: Layout appears sane\n");
+ assert(skiboot_part_hdr);
return 0;
failed:
return -1;
@@ -234,6 +235,8 @@ const char *nvram_query(const char *key)
if (!nvram_validate())
return NULL;
+ assert(skiboot_part_hdr);
+
part_end = (const char *) skiboot_part_hdr
+ be16_to_cpu(skiboot_part_hdr->len) * 16 - 1;
diff --git a/core/nvram.c b/core/nvram.c
index de6cbdd..1c3cdfa 100644
--- a/core/nvram.c
+++ b/core/nvram.c
@@ -69,8 +69,10 @@ opal_call(OPAL_WRITE_NVRAM, opal_write_nvram, 3);
bool nvram_validate(void)
{
- if (!nvram_valid)
- nvram_valid = !nvram_check(nvram_image, nvram_size);
+ if (!nvram_valid) {
+ if (!nvram_check(nvram_image, nvram_size))
+ nvram_valid = true;
+ }
return nvram_valid;
}
@@ -87,7 +89,7 @@ static void nvram_reformat(void)
if (platform.nvram_write)
platform.nvram_write(0, nvram_image, nvram_size);
- nvram_valid = true;
+ nvram_validate();
}
void nvram_reinit(void)