[PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Mar 25 23:25:44 UTC 2024


Hi Dan

> > We already have for_each_endpoint_of_node(), don't use
> > of_graph_get_next_endpoint() directly. Replace it.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> > ---
(snip)
> > -	for (i = 0; ; i++) {
> > +	for_each_endpoint_of_node(dev->of_node, endpoint) {
> >  		struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
> >  		struct device_node *rem;
> >  
> > -		endpoint = of_graph_get_next_endpoint(dev->of_node, endpoint);
> > -		if (!endpoint)
> > -			break;
> > -
> >  		sdinfo = &pdata->sub_devs[i];
>                                           ^
> "i" is uninitialized now.
> 
> Also in the initializer it has "struct device_node *endpoint = NULL;"
> which is unnecessary now.  And at the end it has:
> 
> 	of_node_put(endpoint);
> 	return pdata;
> 
> Since endpoint is NULL this was always a pointless no-op but now it's
> more obvious, so lets delete that.

Thank you for pointing it.
I will wait other feedback, and post v2 patch in next week.

Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto


More information about the dri-devel mailing list