Re: [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop
From: Vinod Koul <vkoul@kernel.org>
Date: 2026-01-01 11:51:18
Also in:
dmaengine, lkml
From: Vinod Koul <vkoul@kernel.org>
Date: 2026-01-01 11:51:18
Also in:
dmaengine, lkml
On 24-12-25, 13:45, Krzysztof Kozlowski wrote:
Use scoped for-each loop when iterating over device nodes to make code a bit simpler.
Hey Krzysztof, This fails to apply for me, can you please rebase and post again
Signed-off-by: Krzysztof Kozlowski <redacted> --- drivers/dma/dma-axi-dmac.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index 5b06b0dc67ee..45364b1e47f4 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c@@ -925,24 +925,21 @@ static int axi_dmac_parse_chan_dt(struct device_node *of_chan, static int axi_dmac_parse_dt(struct device *dev, struct axi_dmac *dmac) { - struct device_node *of_channels, *of_chan; - int ret; + struct device_node *of_channels; + int ret = 0; of_channels = of_get_child_by_name(dev->of_node, "adi,channels"); if (of_channels == NULL) return -ENODEV; - for_each_child_of_node(of_channels, of_chan) { + for_each_child_of_node_scoped(of_channels, of_chan) { ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan); - if (ret) { - of_node_put(of_chan); - of_node_put(of_channels); - return -EINVAL; - } + if (ret) + break; } of_node_put(of_channels); - return 0; + return ret; } static int axi_dmac_read_chan_config(struct device *dev, struct axi_dmac *dmac)-- 2.51.0
-- ~Vinod