diff mbox series

dmaengine: mv_xor: Call of_node_put() when breaking out of for_each_child_of_node()

Message ID 20220708092753.312034-1-windhl@126.com (mailing list archive)
State Changes Requested
Headers show
Series dmaengine: mv_xor: Call of_node_put() when breaking out of for_each_child_of_node() | expand

Commit Message

Liang He July 8, 2022, 9:27 a.m. UTC
In mv_xor_probe(), for_each_child_of_node() will automatically
increase and decrease the refcount. We should call of_node_put()
when breaking out of the iteration.

Fixes: f7d12ef53ddf ("dma: mv_xor: add Device Tree binding")
Signed-off-by: Liang He <windhl@126.com>
---
 drivers/dma/mv_xor.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 23b232b57518..3a5c87f992d1 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1392,6 +1392,7 @@  static int mv_xor_probe(struct platform_device *pdev)
 
 			irq = irq_of_parse_and_map(np, 0);
 			if (!irq) {
+				of_node_put(np);
 				ret = -ENODEV;
 				goto err_channel_add;
 			}
@@ -1399,6 +1400,7 @@  static int mv_xor_probe(struct platform_device *pdev)
 			chan = mv_xor_channel_add(xordev, pdev, i,
 						  cap_mask, irq);
 			if (IS_ERR(chan)) {
+				of_node_put(np);
 				ret = PTR_ERR(chan);
 				irq_dispose_mapping(irq);
 				goto err_channel_add;