Re: [PATCH 0/2] hwmon: use device_for_each_child_node_scoped()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/04/2024 13:13, Javier Carrasco wrote:
> Switch to the _scoped() version introduced in commit 365130fd47af
> ("device property: Introduce device_for_each_child_node_scoped()")
> to remove the need for manual calling of fwnode_handle_put() in the
> paths where the code exits the loop early.
> 
> There are only two users of the non scoped version in the hwmon
> subsystem:
> 
> - ltc2991
> - gsc-hwmon
> 
> All calls of fwnode_handle_put() were in error paths.
> 
> This series is based on the master branch of linux-next (next-20240404)
> to profif from the scoped version of device_for_each_child_node().
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
> ---
> Javier Carrasco (2):
>       hwmon: (ltc2991) use device_for_each_child_node_scoped()
>       hwmon: (gsc-hwmon) use device_for_each_child_node_scoped()
> 
>  drivers/hwmon/gsc-hwmon.c |  7 +------
>  drivers/hwmon/ltc2991.c   | 11 +++--------
>  2 files changed, 4 insertions(+), 14 deletions(-)
> ---
> base-commit: 2b3d5988ae2cb5cd945ddbc653f0a71706231fdd
> change-id: 20240404-hwmon_device_for_each_child_node_scoped-6e581c1d8a31
> 
> Best regards,


Hi, this patch appears as "superseded" in the patchwork, but I could not
find what series actually superseded it.

I just noticed that the cleanup in ltc2991.c turns out to be a bug fix
as well because there is an error path if "shunt-resistor-micro-ohms" is
zero that misses the required fwnode_handle_put().

This is something similar like the recently applied fix for the ltc2992
[1], but in this case the _scoped() macro already exists and is in use
in the mainline kernel, and no explicit call to fwnode_handle_put() is
required unless the fix is to be ported to old kernels that don't have
the device_for_each_child_node_scoped() macro.

Link:
https://lore.kernel.org/linux-hwmon/20240523-fwnode_for_each_available_child_node_scoped-v2-0-701f3a03f2fb@xxxxxxxxx/
[1]

Best regards,
Javier Carrasco




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux