Fix following coccicheck warning:
./drivers/mailbox/zynqmp-ipi-mailbox.c:654:1-33: WARNING: Function
for_each_available_child_of_node should have of_node_put() before goto
Early exits from for_each_available_child_of_node should decrement the
node reference counter.
Signed-off-by: Wan Jiabing <[email protected]>
---
drivers/mailbox/zynqmp-ipi-mailbox.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index f44079d62b1a..67d4203fb4f5 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -657,6 +657,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "failed to probe subdev.\n");
ret = -EINVAL;
+ of_node_put(nc);
goto free_mbox_dev;
}
mbox++;
--
2.20.1
+Wendy: Please check.
M
On 10/18/21 03:34, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./drivers/mailbox/zynqmp-ipi-mailbox.c:654:1-33: WARNING: Function
> for_each_available_child_of_node should have of_node_put() before goto
>
> Early exits from for_each_available_child_of_node should decrement the
> node reference counter.
>
> Signed-off-by: Wan Jiabing <[email protected]>
> ---
> drivers/mailbox/zynqmp-ipi-mailbox.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
> index f44079d62b1a..67d4203fb4f5 100644
> --- a/drivers/mailbox/zynqmp-ipi-mailbox.c
> +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
> @@ -657,6 +657,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
> if (ret) {
> dev_err(dev, "failed to probe subdev.\n");
> ret = -EINVAL;
> + of_node_put(nc);
> goto free_mbox_dev;
> }
> mbox++;
>