diff options
author | Angel Pons <th3fanbus@gmail.com> | 2023-05-10 21:57:45 +0200 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2023-05-12 08:31:06 +0000 |
commit | b327425420b30ed90a5dfbe3ce10312b3dd9dd3c (patch) | |
tree | edea8e941c5d121e3f0df569a64154487ecc85fd /src/mainboard | |
parent | b20f8bd747a962cc7cb235e6d3c2b615bd9426d7 (diff) |
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>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/prodrive/atlas/vpd.c | 9 |
1 files 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: |