From b327425420b30ed90a5dfbe3ce10312b3dd9dd3c Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 10 May 2023 21:57:45 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/75132 Tested-by: build bot (Jenkins) Reviewed-by: Benjamin Doron --- src/mainboard/prodrive/atlas/vpd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mainboard/prodrive/atlas/vpd.c b/src/mainboard/prodrive/atlas/vpd.c index 75d1cafd6e..ba249a94d7 100644 --- a/src/mainboard/prodrive/atlas/vpd.c +++ b/src/mainboard/prodrive/atlas/vpd.c @@ -8,6 +8,11 @@ #include "mainboard.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) { static union { @@ -48,8 +53,8 @@ const struct emi_eeprom_vpd *get_emi_eeprom_vpd(void) case 0: memset(vpd.raw, 0, sizeof(vpd.raw)); vpd.layout.header.magic = VPD_MAGIC; - vpd.layout.serial_number[0] = '\0'; - vpd.layout.part_number[0] = '\0'; + write_invalid_str(vpd.layout.serial_number, sizeof(vpd.layout.serial_number)); + write_invalid_str(vpd.layout.part_number, sizeof(vpd.layout.part_number)); vpd.layout.profile = ATLAS_PROF_UNPROGRAMMED; __fallthrough; default: -- cgit v1.2.1