Skip to content

Commit

Permalink
npu2: Replace open coded dt_find_by_name_addr()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rarbab authored and stewartsmith committed Jan 16, 2019
1 parent 3f79ab6 commit 38cf215
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions hw/npu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 38cf215

Please sign in to comment.