linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop
@ 2025-12-24 12:45 Krzysztof Kozlowski
  2025-12-24 12:45 ` [PATCH 2/2] dmaengine: xilinx: " Krzysztof Kozlowski
  2026-01-01 11:51 ` [PATCH 1/2] dmaengine: axi-dmac: " Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:45 UTC (permalink / raw)
  To: Lars-Peter Clausen, Vinod Koul, Michal Simek, dmaengine,
	linux-kernel, linux-arm-kernel
  Cc: Krzysztof Kozlowski

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>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-01 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-24 12:45 [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:45 ` [PATCH 2/2] dmaengine: xilinx: " Krzysztof Kozlowski
2026-01-01 11:51 ` [PATCH 1/2] dmaengine: axi-dmac: " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).