From: "Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
To: Vinod Koul <vkoul@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Paul Cercueil <paul@crapouillou.net>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND 4/4] dma: dma-axi-dmac: simplify axi_dmac_parse_dt()
Date: Tue, 04 Nov 2025 16:22:28 +0000 [thread overview]
Message-ID: <20251104-axi-dmac-fixes-and-improvs-v1-4-3e6fd9328f72@analog.com> (raw)
In-Reply-To: <20251104-axi-dmac-fixes-and-improvs-v1-0-3e6fd9328f72@analog.com>
From: Nuno Sá <nuno.sa@analog.com>
Simplify axi_dmac_parse_dt() by using the cleanup device_node class for
automatically releasing the of_node reference when going out of scope.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
drivers/dma/dma-axi-dmac.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 15c569449a28..045e9b9a90df 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -8,6 +8,7 @@
#include <linux/adi-axi-common.h>
#include <linux/bitfield.h>
+#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
@@ -927,22 +928,18 @@ 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;
- of_channels = of_get_child_by_name(dev->of_node, "adi,channels");
+ struct device_node *of_channels __free(device_node) = 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);
+ if (ret)
return -EINVAL;
- }
}
- of_node_put(of_channels);
return 0;
}
--
2.51.0
next prev parent reply other threads:[~2025-11-04 16:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 16:22 [PATCH RESEND 0/4] dma: dma-axi-dmac: fixes and improvements Nuno Sá via B4 Relay
2025-11-04 16:22 ` [PATCH RESEND 1/4] dma: dma-axi-dmac: fix SW cyclic transfers Nuno Sá via B4 Relay
2025-11-04 16:22 ` [PATCH RESEND 2/4] dma: dma-axi-dmac: fix HW scatter-gather not looking at the queue Nuno Sá via B4 Relay
2025-11-04 16:22 ` [PATCH RESEND 3/4] dma: dma-axi-dmac: support bigger than 32bits addresses Nuno Sá via B4 Relay
2025-11-04 16:22 ` Nuno Sá via B4 Relay [this message]
2025-11-05 12:12 ` [PATCH RESEND 0/4] dma: dma-axi-dmac: fixes and improvements Hennerich, Michael
2025-12-23 11:28 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251104-axi-dmac-fixes-and-improvs-v1-4-3e6fd9328f72@analog.com \
--to=devnull+nuno.sa.analog.com@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=dmaengine@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=paul@crapouillou.net \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®