iio: temp: ltc2983: Use __free(fwnode_handle) and device_for_each_node_scoped()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 24 Feb 2024 12:32:07 +0000 (12:32 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 25 Mar 2024 19:50:10 +0000 (19:50 +0000)
commit8ca555bd059a4e645b5cf0ec09c3e002a3d347af
tree334950b0dad8f56b32bb7eb5d4b0966acc3f114c
parente1186ee3f48eb29c296f30232ab0c0997c0c6a06
iio: temp: ltc2983: Use __free(fwnode_handle) and device_for_each_node_scoped()

This use of the new cleanup.h scope based freeing infrastructure allows
us to exit directly from error conditions and in the good path with
the reference obtained from fwnode_find_reference() (which may be an error
pointer) automatically released.

Similarly the _scoped() version of device_for_each_child_node()
removes the need for the manual calling of fwnode_handl_put() in
paths where the code exits the loop early.

Tidy up some unusual indentation in a dev_dbg() whilst here.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240224123215.161469-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/temperature/ltc2983.c