drivers/mrc_cache: Avoid `sizeof` on struct type
Where applicable, use the size of the associated variable.
Change-Id: Icf4f1c8fe9f54c44b041a65eb46d6ec9f9fd6367
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55902
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c
index f97031d..841c97e 100644
--- a/src/drivers/mrc_cache/mrc_cache.c
+++ b/src/drivers/mrc_cache/mrc_cache.c
@@ -486,7 +486,7 @@
struct update_region_file_entry entries[] = {
[0] = {
- .size = sizeof(struct mrc_metadata),
+ .size = sizeof(*new_md),
.data = new_md,
},
[1] = {
@@ -696,7 +696,7 @@
.data_checksum = compute_ip_checksum(data, size),
};
md.header_checksum =
- compute_ip_checksum(&md, sizeof(struct mrc_metadata));
+ compute_ip_checksum(&md, sizeof(md));
if (CONFIG(MRC_STASH_TO_CBMEM)) {
/* Store data in cbmem for use in ramstage */