Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: core: Use fwnode_for_each_child_node_scoped()

Replace the manual __free(fwnode_handle) iterator declaration with the
new scoped iterator macro for cleaner, less error-prone code.

This eliminates the need for explicit iterator variable declaration with
the cleanup attribute, making the code more consistent with other scoped
iterator usage patterns in the kernel.

Signed-off-by: Jean-François Lessard <jefflessard3@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

authored by

Jean-François Lessard and committed by
Wolfram Sang
d32bb695 448097bb

+1 -2
+1 -2
drivers/i2c/i2c-core-slave.c
··· 112 112 struct fwnode_handle *fwnode = dev_fwnode(dev); 113 113 114 114 if (is_of_node(fwnode)) { 115 - struct fwnode_handle *child __free(fwnode_handle) = NULL; 116 115 u32 reg; 117 116 118 - fwnode_for_each_child_node(fwnode, child) { 117 + fwnode_for_each_child_node_scoped(fwnode, child) { 119 118 fwnode_property_read_u32(child, "reg", &reg); 120 119 if (reg & I2C_OWN_SLAVE_ADDRESS) 121 120 return true;