aboutsummaryrefslogtreecommitdiff
path: root/hw/npu2.c
diff options
context:
space:
mode:
authorReza Arbab <arbab@linux.ibm.com>2019-01-09 09:58:51 -0600
committerStewart Smith <stewart@linux.ibm.com>2019-01-16 00:46:49 -0600
commit38cf215cb505cc2875061e4be57c7aa0236762df (patch)
treed9afc373216e5e85194cda3e3671f5bb0eddde44 /hw/npu2.c
parent3f79ab6cdb4dbb7dd5baa55b13c257173ade15c2 (diff)
downloadskiboot-38cf215cb505cc2875061e4be57c7aa0236762df.zip
skiboot-38cf215cb505cc2875061e4be57c7aa0236762df.tar.gz
skiboot-38cf215cb505cc2875061e4be57c7aa0236762df.tar.bz2
npu2: Replace open coded dt_find_by_name_addr()
We now have a dt function to do this. Use it. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/npu2.c')
-rw-r--r--hw/npu2.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/hw/npu2.c b/hw/npu2.c
index 68a5382..d6b634d 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -605,20 +605,9 @@ static void npu2_append_phandle(struct dt_node *dn,
static struct dt_node *npu2_create_memory_dn(uint64_t addr, uint64_t size)
{
struct dt_node *mem;
- char *name;
- size_t namesz;
static u32 chip_id = 255;
- /*
- * Find and return the node if it already exists.
- */
- namesz = sizeof("memory@") + STR_MAX_CHARS(addr);
- name = malloc(namesz);
- if (!name)
- return NULL;
- snprintf(name, namesz, "memory@%llx", (long long)addr);
- mem = dt_find_by_name(dt_root, name);
- free(name);
+ mem = dt_find_by_name_addr(dt_root, "memory", addr);
if (mem)
return mem;