mb/prodrive/atlas: Make default SN/PN not empty

If reading the serial/part number fails, returning an empty string is
very confusing. Instead, return "INVALID" to make problems obvious.

Change-Id: I3c174ca76d51b44456c7b68f4fcffb4c8f9379be
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75132
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Benjamin Doron <benjamin.doron00@gmail.com>
This commit is contained in:
Angel Pons 2023-05-10 21:57:45 +02:00 committed by Lean Sheng Tan
parent b20f8bd747
commit b327425420
1 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,11 @@
#include "mainboard.h" #include "mainboard.h"
#include "vpd.h" #include "vpd.h"
static void write_invalid_str(char *dest, size_t length)
{
snprintf(dest, length, "%s", "INVALID");
}
const struct emi_eeprom_vpd *get_emi_eeprom_vpd(void) const struct emi_eeprom_vpd *get_emi_eeprom_vpd(void)
{ {
static union { static union {
@ -48,8 +53,8 @@ const struct emi_eeprom_vpd *get_emi_eeprom_vpd(void)
case 0: case 0:
memset(vpd.raw, 0, sizeof(vpd.raw)); memset(vpd.raw, 0, sizeof(vpd.raw));
vpd.layout.header.magic = VPD_MAGIC; vpd.layout.header.magic = VPD_MAGIC;
vpd.layout.serial_number[0] = '\0'; write_invalid_str(vpd.layout.serial_number, sizeof(vpd.layout.serial_number));
vpd.layout.part_number[0] = '\0'; write_invalid_str(vpd.layout.part_number, sizeof(vpd.layout.part_number));
vpd.layout.profile = ATLAS_PROF_UNPROGRAMMED; vpd.layout.profile = ATLAS_PROF_UNPROGRAMMED;
__fallthrough; __fallthrough;
default: default: