diff options
author | Reza Arbab <arbab@linux.ibm.com> | 2019-01-09 09:58:51 -0600 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-01-16 00:46:49 -0600 |
commit | 38cf215cb505cc2875061e4be57c7aa0236762df (patch) | |
tree | d9afc373216e5e85194cda3e3671f5bb0eddde44 | |
parent | 3f79ab6cdb4dbb7dd5baa55b13c257173ade15c2 (diff) | |
download | skiboot-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>
-rw-r--r-- | hw/npu2.c | 13 |
1 files changed, 1 insertions, 12 deletions
@@ -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; |