Skip to content

Commit f8bae63

Browse files
remoteproc: rcar_rproc: Call of_node_put() on iteration error
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: 285892a ("remoteproc: Add Renesas rcar driver") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20230320221826.2728078-4-mathieu.poirier@linaro.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 8a74918 commit f8bae63

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/remoteproc/rcar_rproc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@ static int rcar_rproc_prepare(struct rproc *rproc)
6262

6363
rmem = of_reserved_mem_lookup(it.node);
6464
if (!rmem) {
65+
of_node_put(it.node);
6566
dev_err(&rproc->dev,
6667
"unable to acquire memory-region\n");
6768
return -EINVAL;
6869
}
6970

70-
if (rmem->base > U32_MAX)
71+
if (rmem->base > U32_MAX) {
72+
of_node_put(it.node);
7173
return -EINVAL;
74+
}
7275

7376
/* No need to translate pa to da, R-Car use same map */
7477
da = rmem->base;
@@ -79,8 +82,10 @@ static int rcar_rproc_prepare(struct rproc *rproc)
7982
rcar_rproc_mem_release,
8083
it.node->name);
8184

82-
if (!mem)
85+
if (!mem) {
86+
of_node_put(it.node);
8387
return -ENOMEM;
88+
}
8489

8590
rproc_add_carveout(rproc, mem);
8691
}

0 commit comments

Comments
 (0)