Skip to content

Commit 5ef074e

Browse files
remoteproc: imx_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: b29b424 ("remoteproc: imx_rproc: add i.MX specific parse fw hook") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20230320221826.2728078-5-mathieu.poirier@linaro.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent f8bae63 commit 5ef074e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/remoteproc/imx_rproc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
541541

542542
rmem = of_reserved_mem_lookup(it.node);
543543
if (!rmem) {
544+
of_node_put(it.node);
544545
dev_err(priv->dev, "unable to acquire memory-region\n");
545546
return -EINVAL;
546547
}
@@ -553,10 +554,12 @@ static int imx_rproc_prepare(struct rproc *rproc)
553554
imx_rproc_mem_alloc, imx_rproc_mem_release,
554555
it.node->name);
555556

556-
if (mem)
557+
if (mem) {
557558
rproc_coredump_add_segment(rproc, da, rmem->size);
558-
else
559+
} else {
560+
of_node_put(it.node);
559561
return -ENOMEM;
562+
}
560563

561564
rproc_add_carveout(rproc, mem);
562565
}

0 commit comments

Comments
 (0)