Skip to content

Commit

Permalink
hdata: Make sure reserved node name starts with "ibm, "
Browse files Browse the repository at this point in the history
HDAT does not provide consistent label format for reserved memory label.
Few starts with "ibm," while few other starts with component name.

Lets make sure all the reserved node name starts with "ibm,".

Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
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 Sep 13, 2018
1 parent 70a7a3f commit 50d508c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hdata/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ static struct dt_node *dt_hb_reserves;

static struct dt_node *add_hb_reserve_node(const char *name, u64 start, u64 end)
{
/* label size + "ibm," + NULL */
char node_name[HB_RESERVE_MEM_LABEL_SIZE + 5] = { 0 };
struct dt_node *node, *hb;

if (!dt_hb_reserves) {
Expand All @@ -580,10 +582,15 @@ static struct dt_node *add_hb_reserve_node(const char *name, u64 start, u64 end)
dt_add_property_cells(dt_hb_reserves, "#address-cells", 2);
}

node = dt_new_addr(dt_hb_reserves, name, start);
/* Add "ibm," to reserved node name */
if (strncasecmp(name, "ibm", 3))
snprintf(node_name, 5, "ibm,");
strcat(node_name, name);

node = dt_new_addr(dt_hb_reserves, node_name, start);
if (!node) {
prerror("Unable to create node for %s@%llx\n",
name, (unsigned long long) start);
node_name, (unsigned long long) start);
return NULL;
}

Expand Down

0 comments on commit 50d508c

Please sign in to comment.