[PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop
Krzysztof Kozlowski
krzysztof.kozlowski at oss.qualcomm.com
Wed Dec 24 04:45:32 PST 2025
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at 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
More information about the linux-arm-kernel
mailing list