[PATCH] mailbox: cmdq: Add of_node_put() before return

Wan Jiabing wanjiabing at vivo.com
Sun Oct 17 18:33:14 PDT 2021


Fix following coccicheck warning:
./drivers/mailbox/mtk-cmdq-mailbox.c:572:2-24: WARNING: Function
for_each_child_of_node should have of_node_put() before return

Early exits from for_each_child_of_node should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing at vivo.com>
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 64175a893312..ab4f42cc987d 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -579,6 +579,7 @@ static int cmdq_probe(struct platform_device *pdev)
 				cmdq->clocks[alias_id].clk = of_clk_get(node, 0);
 				if (IS_ERR(cmdq->clocks[alias_id].clk)) {
 					dev_err(dev, "failed to get gce clk: %d\n", alias_id);
+					of_node_put(node);
 					return PTR_ERR(cmdq->clocks[alias_id].clk);
 				}
 			}
-- 
2.20.1




More information about the linux-arm-kernel mailing list