public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/4] iio: adc: use scoped device_for_each_childe_node()
@ 2024-09-26 16:08 Javier Carrasco
  2024-09-26 16:08 ` [PATCH 1/4] iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node() Javier Carrasco
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Javier Carrasco @ 2024-09-26 16:08 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Michael Hennerich
  Cc: linux-arm-msm, linux-iio, linux-kernel, linux-arm-kernel,
	linux-sunxi, Javier Carrasco

The device_for_each_child_node() macro requires calls to
fwnode_handle_put() upon early exits (break/return), and that has been a
constant source of bugs in the kernel.

This series switches to the more secure, scoped version of the macro
in the IIO subsystem, wherever the loop contains error paths. This
change simplifies the code and removes the explicit calls to
fwnode_handle_put(). In all cases the child node is only used for
parsing, and not assigned to be used later.

The straightforward uses of the loop with no error paths have been left
untouched, as their simplicity justifies the non-scoped variant.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Javier Carrasco (4):
      iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node()
      iio: adc: qcom-spmi-vadc: use scoped device_for_each_child_node()
      iio: adc: sun20i-gpadc: use scoped device_for_each_child_node()
      iio: adc: ad5755: use scoped device_for_each_child_node()

 drivers/iio/adc/qcom-pm8xxx-xoadc.c |  8 +++-----
 drivers/iio/adc/qcom-spmi-vadc.c    |  7 ++-----
 drivers/iio/adc/sun20i-gpadc-iio.c  |  7 ++-----
 drivers/iio/dac/ad5755.c            | 11 +++--------
 4 files changed, 10 insertions(+), 23 deletions(-)
---
base-commit: 92fc9636d1471b7f68bfee70c776f7f77e747b97
change-id: 20240926-iio_device_for_each_child_node_scoped-cb534e6f5d9b

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>



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

end of thread, other threads:[~2024-09-28 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 16:08 [PATCH 0/4] iio: adc: use scoped device_for_each_childe_node() Javier Carrasco
2024-09-26 16:08 ` [PATCH 1/4] iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node() Javier Carrasco
2024-09-26 16:08 ` [PATCH 2/4] iio: adc: qcom-spmi-vadc: " Javier Carrasco
2024-09-26 16:08 ` [PATCH 3/4] iio: adc: sun20i-gpadc: " Javier Carrasco
2024-09-26 16:48   ` Chen-Yu Tsai
2024-09-26 16:08 ` [PATCH 4/4] iio: adc: ad5755: " Javier Carrasco
2024-09-28 16:29 ` [PATCH 0/4] iio: adc: use scoped device_for_each_childe_node() Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox