On Tue, May 4, 2021 at 2:53 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > On 5/4/21 10:00 AM, Andy Shevchenko wrote: > > On Monday, May 3, 2021, Hans de Goede <hdegoede@xxxxxxxxxx <mailto:hdegoede@xxxxxxxxxx>> wrote: ... > > +struct drm_connector *drm_connector_find_by_fwnode(struct fwnode_handle *fwnode) > > +{ > > + struct drm_connector *connector, *found = ERR_PTR(-ENODEV); > > + > > + if (!fwnode) > > + return ERR_PTR(-ENODEV); > > + > > + mutex_lock(&connector_list_lock); > > + > > + list_for_each_entry(connector, &connector_list, global_connector_list_entry) { > > + if (connector->fwnode == fwnode || > > + (connector->fwnode && connector->fwnode->secondary == fwnode)) { > > + drm_connector_get(connector); > > + found = connector; > > + break; > > + } > > + } > > + > > + mutex_unlock(&connector_list_lock); > > + > > + return found; > > > > If I am not mistaken you can replace this with > > > > return list_entry_is_head(); > > > > call and remove additional Boolean variable. > > Found is not a boolean, it is a pointer to the found connector (or ERR_PTR(-ENODEV)). Ah, perhaps giving a better name? `match` ? And to the initial topic, it's either an additional variable or additional branch in this case. I think additional branch (taking into account the length of the line or amount of lines) doesn't buy us anything. > > +} -- With Best Regards, Andy Shevchenko _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx