]> Gentwo Git Trees - linux/.git/commitdiff
i2c: core: Use fwnode_for_each_child_node_scoped()
authorJean-François Lessard <jefflessard3@gmail.com>
Tue, 2 Sep 2025 19:04:40 +0000 (15:04 -0400)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 10 Sep 2025 12:49:45 +0000 (14:49 +0200)
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>
drivers/i2c/i2c-core-slave.c

index 7ee6b992b835f5be0a7f2c15c075ab50af0628e2..02ca55c2246bcf2b517b8c235a2438c552a2ce2f 100644 (file)
@@ -112,10 +112,9 @@ bool i2c_detect_slave_mode(struct device *dev)
        struct fwnode_handle *fwnode = dev_fwnode(dev);
 
        if (is_of_node(fwnode)) {
-               struct fwnode_handle *child __free(fwnode_handle) = NULL;
                u32 reg;
 
-               fwnode_for_each_child_node(fwnode, child) {
+               fwnode_for_each_child_node_scoped(fwnode, child) {
                        fwnode_property_read_u32(child, "reg", &reg);
                        if (reg & I2C_OWN_SLAVE_ADDRESS)
                                return true;