Skip to content

Commit 86e78fc

Browse files
govind-varadarmichalsimek
authored andcommitted
misc: xilinx-ai-engine: Remove extra of_node_get in aperture probe
for_each_available_child_of_node() in of_xilinx_ai_engine_aperture_probe calls of_node_get() internally. Driver does not need to call of_node_get and increment the refcounter again. This causes [ 510.309943] OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/ai_engine@20000000000 Remove of_node_get() in aperture probe and call of_node_put() in case of aperture probe failure. Signed-off-by: Govindarajulu Varadarajan <govindarajulu.varadarajan@amd.com> Message-ID: <20241029011708.2154933-1-govindarajulu.varadarajan@amd.com>
1 parent 6d68d43 commit 86e78fc

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

drivers/misc/xilinx-ai-engine/ai-engine-aperture.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,6 @@ of_aie_aperture_probe(struct aie_device *adev, struct device_node *nc)
580580
goto put_aperture_dev;
581581
}
582582

583-
of_node_get(nc);
584-
585583
ret = aie_aperture_sysfs_create_entries(aperture);
586584
if (ret) {
587585
dev_err(dev, "Failed to create aperture sysfs: %d\n", ret);

drivers/misc/xilinx-ai-engine/ai-engine-dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ void of_xilinx_ai_engine_aperture_probe(struct aie_device *adev)
470470
dev_err(&adev->dev,
471471
"Failed to probe AI engine aperture for %pOF\n",
472472
nc);
473+
of_node_put(nc);
473474
/* try to probe the next node */
474475
continue;
475476
}

0 commit comments

Comments
 (0)