mb/pcengines/apuX: Refactor to avoid dead assignment

The initial value of `len` is never used. Declare and initialise all
local variables in a single statement to avoid this problem.

Change-Id: Ieb96758f4cd19d9d3f8fdc543e8ca17db06a2123
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55905
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Angel Pons 2021-06-28 15:40:58 +02:00 committed by Patrick Georgi
parent 35b99c64e6
commit 631cd29efb
2 changed files with 6 additions and 12 deletions

View File

@ -168,14 +168,11 @@ static void config_addon_uart(void)
#if CONFIG(GENERATE_SMBIOS_TABLES) #if CONFIG(GENERATE_SMBIOS_TABLES)
static int mainboard_smbios_type16(DMI_INFO *agesa_dmi, int *handle, unsigned long *current) static int mainboard_smbios_type16(DMI_INFO *agesa_dmi, int *handle, unsigned long *current)
{ {
struct smbios_type16 *t; const u32 max_capacity = get_spd_offset() ? 4 : 2; /* 4GB or 2GB variant */
u32 max_capacity;
int len;
t = (struct smbios_type16 *)*current; struct smbios_type16 *t = (struct smbios_type16 *)*current;
len = sizeof(*t); int len = sizeof(*t);
memset(t, 0, len); memset(t, 0, len);
max_capacity = get_spd_offset() ? 4 : 2; /* 4GB or 2GB variant */
t->type = SMBIOS_PHYS_MEMORY_ARRAY; t->type = SMBIOS_PHYS_MEMORY_ARRAY;
t->handle = *handle; t->handle = *handle;

View File

@ -150,14 +150,11 @@ static void config_gpio_mux(void)
static int mainboard_smbios_type16(DMI_INFO *agesa_dmi, int *handle, static int mainboard_smbios_type16(DMI_INFO *agesa_dmi, int *handle,
unsigned long *current) unsigned long *current)
{ {
struct smbios_type16 *t; const u32 max_capacity = get_spd_offset() ? 4 : 2; /* 4GB or 2GB variant */
u32 max_capacity;
int len = 0;
t = (struct smbios_type16 *)*current; struct smbios_type16 *t = (struct smbios_type16 *)*current;
len = sizeof(*t); int len = sizeof(*t);
memset(t, 0, len); memset(t, 0, len);
max_capacity = get_spd_offset() ? 4 : 2; /* 4GB or 2GB variant */
t->type = SMBIOS_PHYS_MEMORY_ARRAY; t->type = SMBIOS_PHYS_MEMORY_ARRAY;
t->handle = *handle; t->handle = *handle;