On Fri, Feb 25, 2022 at 12:07:46AM +0000, Daniel Scally wrote: > Move the endpoint checking from .probe() to a dedicated function, > and additionally check that the firmware provided link frequencies > are a match for those supported by the driver. Store the index to the > matching link frequency so it can be easily identified later. ... > + ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &bus_cfg); > + fwnode_handle_put(endpoint); > + if (ret) > + return dev_err_probe(ov7251->dev, ret, > + "parsing endpoint node failed\n"); > + > + if (!bus_cfg.nr_of_link_frequencies) { > + dev_err(ov7251->dev, "no link frequencies defined\n"); > + ret = -EINVAL; It's also fine to use dev_err_probe() here. > + goto out_free_bus_cfg; > + } > + > + for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++) { > + for (j = 0; j < ARRAY_SIZE(link_freq); j++) > + if (bus_cfg.link_frequencies[i] == link_freq[j]) { > + freq_found = true; > + break; > + } > + > + if (freq_found) > + break; freq_found may be replaced by the if (j < ARRAY_SIZE(link_freq)) here. > + } > + > + if (i == bus_cfg.nr_of_link_frequencies) { > + dev_err(ov7251->dev, "no supported link freq found\n"); > + ret = -EINVAL; dev_err_probe() > + goto out_free_bus_cfg; > + } > + > + ov7251->link_freq_idx = i; > + > +out_free_bus_cfg: > + v4l2_fwnode_endpoint_free(&bus_cfg); > + > + return ret; > +} -- With Best Regards, Andy Shevchenko