Skip to content

Commit 9f6caa3

Browse files
javiercarrascocruzvinodkoul
authored andcommitted
dmaengine: mv_xor: switch to for_each_child_of_node_scoped()
Introduce the scoped variant of the loop to automatically release the child node when it goes out of scope, which is more robust than the non-scoped variant, and accounts for new early exits that could be added in the future. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://lore.kernel.org/r/20241011-dma_mv_xor_of_node_put-v1-2-3c2de819f463@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 36d8cbd commit 9f6caa3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/dma/mv_xor.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,10 +1369,9 @@ static int mv_xor_probe(struct platform_device *pdev)
13691369
return 0;
13701370

13711371
if (pdev->dev.of_node) {
1372-
struct device_node *np;
13731372
int i = 0;
13741373

1375-
for_each_child_of_node(pdev->dev.of_node, np) {
1374+
for_each_child_of_node_scoped(pdev->dev.of_node, np) {
13761375
struct mv_xor_chan *chan;
13771376
dma_cap_mask_t cap_mask;
13781377
int irq;
@@ -1388,7 +1387,6 @@ static int mv_xor_probe(struct platform_device *pdev)
13881387
irq = irq_of_parse_and_map(np, 0);
13891388
if (!irq) {
13901389
ret = -ENODEV;
1391-
of_node_put(np);
13921390
goto err_channel_add;
13931391
}
13941392

@@ -1397,7 +1395,6 @@ static int mv_xor_probe(struct platform_device *pdev)
13971395
if (IS_ERR(chan)) {
13981396
ret = PTR_ERR(chan);
13991397
irq_dispose_mapping(irq);
1400-
of_node_put(np);
14011398
goto err_channel_add;
14021399
}
14031400

0 commit comments

Comments
 (0)