summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-28 15:36:23 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-07-01 07:35:02 +0000
commit35b99c64e62fd84866dd269a3641b66646f9557f (patch)
tree8a95363becb766da16e47fadbe87ebca9a5fe06e /src/drivers
parentc6dab80b1cd8fb35115e9876b79abefb6c4f2d91 (diff)
SMBIOS: Avoid `sizeof` on struct type
Where applicable, use the size of the associated variable. Change-Id: Ibbac2a82893232a6f87182a6a965b84a599d633e Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55904 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/elog/elog.c2
-rw-r--r--src/drivers/wifi/generic/smbios.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 4769559ca0..6e31686fe5 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -594,7 +594,7 @@ static inline u8 *elog_flash_offset_to_address(void)
int elog_smbios_write_type15(unsigned long *current, int handle)
{
struct smbios_type15 *t = (struct smbios_type15 *)*current;
- int len = sizeof(struct smbios_type15);
+ int len = sizeof(*t);
uintptr_t log_address;
size_t elog_size = region_device_sz(&elog_state.nv_dev);
diff --git a/src/drivers/wifi/generic/smbios.c b/src/drivers/wifi/generic/smbios.c
index a1a8e4f204..b8191161bb 100644
--- a/src/drivers/wifi/generic/smbios.c
+++ b/src/drivers/wifi/generic/smbios.c
@@ -18,9 +18,9 @@ static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned lon
} __packed;
struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current;
- int len = sizeof(struct smbios_type_intel_wifi);
+ int len = sizeof(*t);
- memset(t, 0, sizeof(struct smbios_type_intel_wifi));
+ memset(t, 0, sizeof(*t));
t->type = 0x85;
t->length = len - 2;
t->handle = *handle;