Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: mv_xor: fix child node refcount handling in early exit

The for_each_child_of_node() loop requires explicit calls to
of_node_put() to decrement the child's refcount upon early exits (break,
goto, return).

Add the missing calls in the two early exits before the goto
instructions.

Cc: stable@vger.kernel.org
Fixes: f7d12ef53ddf ("dma: mv_xor: add Device Tree binding")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241011-dma_mv_xor_of_node_put-v1-1-3c2de819f463@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Javier Carrasco and committed by
Vinod Koul
362f1bf9 ccfa3131

+2
+2
drivers/dma/mv_xor.c
··· 1388 1388 irq = irq_of_parse_and_map(np, 0); 1389 1389 if (!irq) { 1390 1390 ret = -ENODEV; 1391 + of_node_put(np); 1391 1392 goto err_channel_add; 1392 1393 } 1393 1394 ··· 1397 1396 if (IS_ERR(chan)) { 1398 1397 ret = PTR_ERR(chan); 1399 1398 irq_dispose_mapping(irq); 1399 + of_node_put(np); 1400 1400 goto err_channel_add; 1401 1401 } 1402 1402