mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
cmd: smbios: replace missing string by 'Not Specified'
A missing string value is indicated by a string index of 0. In this case print 'Not Specified' like the Linux dmidecode command does. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
@@ -25,6 +25,10 @@ static const char *smbios_get_string(void *table, int index)
|
|||||||
{
|
{
|
||||||
const char *str = (char *)table +
|
const char *str = (char *)table +
|
||||||
((struct smbios_header *)table)->length;
|
((struct smbios_header *)table)->length;
|
||||||
|
static const char fallback[] = "Not Specified";
|
||||||
|
|
||||||
|
if (!index)
|
||||||
|
return fallback;
|
||||||
|
|
||||||
if (!*str)
|
if (!*str)
|
||||||
++str;
|
++str;
|
||||||
@@ -41,7 +45,7 @@ static struct smbios_header *next_table(struct smbios_header *table)
|
|||||||
if (table->type == SMBIOS_END_OF_TABLE)
|
if (table->type == SMBIOS_END_OF_TABLE)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
str = smbios_get_string(table, 0);
|
str = smbios_get_string(table, -1);
|
||||||
return (struct smbios_header *)(++str);
|
return (struct smbios_header *)(++str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user