[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240211174237.182947-8-jic23@kernel.org>
Date: Sun, 11 Feb 2024 17:42:35 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: linux-iio@...r.kernel.org,
Rob Herring <robh@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
linux-kernel@...r.kernel.org,
Julia Lawall <Julia.Lawall@...ia.fr>
Cc: Peter Zijlstra <peterz@...radead.org>,
Nicolas Palix <nicolas.palix@...g.fr>,
Sumera Priyadarsini <sylphrenadin@...il.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nuno Sá <nuno.sa@...log.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [PATCH 7/8] iio: adc: ad7292: Use for_each_available_child_of_node_scoped()
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Avoids the need for manual cleanup of_node_put() in early exits from
the loop.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
---
drivers/iio/adc/ad7292.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c
index cccacec5db6d..a9354bd1ce54 100644
--- a/drivers/iio/adc/ad7292.c
+++ b/drivers/iio/adc/ad7292.c
@@ -260,7 +260,6 @@ static int ad7292_probe(struct spi_device *spi)
{
struct ad7292_state *st;
struct iio_dev *indio_dev;
- struct device_node *child;
bool diff_channels = false;
int ret;
@@ -305,12 +304,10 @@ static int ad7292_probe(struct spi_device *spi)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ad7292_info;
- for_each_available_child_of_node(spi->dev.of_node, child) {
+ for_each_available_child_of_node_scoped(spi->dev.of_node, child) {
diff_channels = of_property_read_bool(child, "diff-channels");
- if (diff_channels) {
- of_node_put(child);
+ if (diff_channels)
break;
- }
}
if (diff_channels) {
--
2.43.1
Powered by blists - more mailing lists