On Wed, May 29, 2024 at 03:40:47AM +0300, Laurent Pinchart wrote: > > @@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device *dev, > > } > > > > /* Iterate through each output port to discover topology */ > > - while ((ep = of_graph_get_next_endpoint(parent, ep))) { > > + for_each_endpoint_of_node(parent, ep) { > > /* > > * Legacy binding mixes input/output ports under the > > * same parent. So, skip the input ports if we are dealing > > I think there's a bug below. The loop contains > > ret = of_coresight_parse_endpoint(dev, ep, pdata); > if (ret) > return ret; > > which leaks the reference to ep. This is not introduced by this patch, Someone should create for_each_endpoint_of_node_scoped(). #define for_each_endpoint_of_node_scoped(parent, child) \ for (struct device_node *child __free(device_node) = \ of_graph_get_next_endpoint(parent, NULL); child != NULL; \ child = of_graph_get_next_endpoint(parent, child)) regards, dan carpenter