]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: xilinx: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Sun, 1 Mar 2026 14:21:59 +0000 (15:21 +0100)
committerVinod Koul <vkoul@kernel.org>
Mon, 9 Mar 2026 07:28:22 +0000 (08:28 +0100)
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260301142158.90319-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/xilinx/xilinx_dma.c

index b53292e02448fe528f1ae9ba33b4bcf408f89fd6..02a05f21561491b120b30858a3d26a04131890f8 100644 (file)
@@ -3180,7 +3180,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
                                        = axivdma_clk_init;
        struct device_node *node = pdev->dev.of_node;
        struct xilinx_dma_device *xdev;
-       struct device_node *child, *np = pdev->dev.of_node;
+       struct device_node *np = pdev->dev.of_node;
        u32 num_frames, addr_width = XILINX_DMA_DFAULT_ADDRWIDTH, len_width;
        int i, err;
 
@@ -3320,12 +3320,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, xdev);
 
        /* Initialize the channels */
-       for_each_child_of_node(node, child) {
+       for_each_child_of_node_scoped(node, child) {
                err = xilinx_dma_child_probe(xdev, child);
-               if (err < 0) {
-                       of_node_put(child);
+               if (err < 0)
                        goto error;
-               }
        }
 
        if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {