Skip to content

Commit

Permalink
hdat: Use dt_add_property_nstr instead of duplicating code
Browse files Browse the repository at this point in the history
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Apr 5, 2017
1 parent 54c4dd2 commit c3a568c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions hdata/vpd.c
Expand Up @@ -562,18 +562,12 @@ static void sysvpd_parse_legacy(const void *sysvpd, unsigned int sysvpd_sz)
const char *model;
const char *system_id;
const char *brand;
char *str;
uint8_t sz;

model = vpd_find(sysvpd, sysvpd_sz, "VSYS", "TM", &sz);
if (model) {
str = zalloc(sz + 1);
if (str) {
memcpy(str, model, sz);
dt_add_property_string(dt_root, "model", str);
free(str);
}
} else
if (model)
dt_add_property_nstr(dt_root, "model", model, sz);
else
dt_add_property_string(dt_root, "model", "Unknown");

system_id = vpd_find(sysvpd, sysvpd_sz, "VSYS", "SE", &sz);
Expand Down

0 comments on commit c3a568c

Please sign in to comment.