File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,10 +112,9 @@ bool i2c_detect_slave_mode(struct device *dev)
112112 struct fwnode_handle * fwnode = dev_fwnode (dev );
113113
114114 if (is_of_node (fwnode )) {
115- struct fwnode_handle * child __free (fwnode_handle ) = NULL ;
116115 u32 reg ;
117116
118- fwnode_for_each_child_node (fwnode , child ) {
117+ fwnode_for_each_child_node_scoped (fwnode , child ) {
119118 fwnode_property_read_u32 (child , "reg" , & reg );
120119 if (reg & I2C_OWN_SLAVE_ADDRESS )
121120 return true;
Original file line number Diff line number Diff line change @@ -176,6 +176,16 @@ struct fwnode_handle *fwnode_get_next_available_child_node(
176176 for (child = fwnode_get_next_available_child_node(fwnode, NULL); child;\
177177 child = fwnode_get_next_available_child_node(fwnode, child))
178178
179+ #define fwnode_for_each_child_node_scoped (fwnode , child ) \
180+ for (struct fwnode_handle *child __free(fwnode_handle) = \
181+ fwnode_get_next_child_node(fwnode, NULL); \
182+ child; child = fwnode_get_next_child_node(fwnode, child))
183+
184+ #define fwnode_for_each_available_child_node_scoped (fwnode , child ) \
185+ for (struct fwnode_handle *child __free(fwnode_handle) = \
186+ fwnode_get_next_available_child_node(fwnode, NULL); \
187+ child; child = fwnode_get_next_available_child_node(fwnode, child))
188+
179189struct fwnode_handle * device_get_next_child_node (const struct device * dev ,
180190 struct fwnode_handle * child );
181191
You can’t perform that action at this time.
0 commit comments