*
* @ctx: SMBIOS context
* @str: string to add
- * Return: string number in the string area (1 or more)
+ * Return: string number in the string area. 0 if str is NULL.
*/
static int smbios_add_string(struct smbios_ctx *ctx, const char *str)
{
int i = 1;
char *p = ctx->eos;
+ if (!str)
+ return 0;
+
for (;;) {
if (!*p) {
ctx->last_str = p;
int ret;
if (!dval || !*dval)
- dval = "Unknown";
+ dval = NULL;
if (!prop)
return smbios_add_string(ctx, dval);
memset(t, 0, sizeof(struct smbios_type1));
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
- t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown");
- t->product_name = smbios_add_prop(ctx, "product", "Unknown");
+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
+ t->product_name = smbios_add_prop(ctx, "product", NULL);
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
- "Unknown");
+ NULL);
if (serial_str) {
t->serial_number = smbios_add_prop(ctx, NULL, serial_str);
strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
} else {
- t->serial_number = smbios_add_prop(ctx, "serial", "Unknown");
+ t->serial_number = smbios_add_prop(ctx, "serial", NULL);
}
- t->sku_number = smbios_add_prop(ctx, "sku", "Unknown");
- t->family = smbios_add_prop(ctx, "family", "Unknown");
+ t->sku_number = smbios_add_prop(ctx, "sku", NULL);
+ t->family = smbios_add_prop(ctx, "family", NULL);
len = t->length + smbios_string_table_len(ctx);
*current += len;
memset(t, 0, sizeof(struct smbios_type2));
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
- t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown");
- t->product_name = smbios_add_prop(ctx, "product", "Unknown");
+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
+ t->product_name = smbios_add_prop(ctx, "product", NULL);
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
- "Unknown");
- t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", "Unknown");
+ NULL);
+ t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", NULL);
t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
t->board_type = SMBIOS_BOARD_MOTHERBOARD;
memset(t, 0, sizeof(struct smbios_type3));
fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
smbios_set_eos(ctx, t->eos);
- t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown");
+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
t->bootup_state = SMBIOS_STATE_SAFE;
t->power_supply_state = SMBIOS_STATE_SAFE;
struct smbios_ctx *ctx)
{
u16 processor_family = SMBIOS_PROCESSOR_FAMILY_UNKNOWN;
- const char *vendor = "Unknown";
- const char *name = "Unknown";
+ const char *vendor = NULL;
+ const char *name = NULL;
#ifdef CONFIG_CPU
char processor_name[49];