aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2017-04-02 16:37:29 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-04-05 12:30:44 +1000
commitc3a568c1e8c1ab990bc3e3824567362099d9f119 (patch)
treeee9023e28dc1203ab6714a76b6b4eb86f7c978d7 /hdata
parent54c4dd27bd30030073ede4b2d154da5583d8e20d (diff)
downloadskiboot-c3a568c1e8c1ab990bc3e3824567362099d9f119.zip
skiboot-c3a568c1e8c1ab990bc3e3824567362099d9f119.tar.gz
skiboot-c3a568c1e8c1ab990bc3e3824567362099d9f119.tar.bz2
hdat: Use dt_add_property_nstr instead of duplicating code
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/vpd.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 5a66140..7f3954a 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -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);