lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1gl1FMAjhXCfCmk@paasikivi.fi.intel.com>
Date:   Tue, 25 Oct 2022 18:07:16 +0000
From:   Sakari Ailus <sakari.ailus@...ux.intel.com>
To:     Jacopo Mondi <jacopo@...ndi.org>
Cc:     Mikhail Rudenko <mike.rudenko@...il.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Shawn Tu <shawnx.tu@...el.com>,
        Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
        Hans Verkuil <hverkuil@...all.nl>,
        Mike Pagano <mpagano@...too.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        Marek Vasut <marex@...x.de>, Jimmy Su <jimmy.su@...el.com>,
        linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] media: i2c: add support for OV4689

Hi Jacopo,

On Tue, Oct 25, 2022 at 03:09:58PM +0200, Jacopo Mondi wrote:
> > +static int ov4689_configure_regulators(struct ov4689 *ov4689)
> > +{
> > +	unsigned int supplies_count = ARRAY_SIZE(ov4689_supply_names);

No need for a temporary variable.

> > +	unsigned int i;
> > +
> > +	for (i = 0; i < supplies_count; i++)
> > +		ov4689->supplies[i].supply = ov4689_supply_names[i];
> > +
> > +	return devm_regulator_bulk_get(&ov4689->client->dev, supplies_count,
> > +				       ov4689->supplies);
> > +}
> > +
> > +static u64 ov4689_check_link_frequency(struct v4l2_fwnode_endpoint *ep)
> > +{
> > +	unsigned int freqs_count = ARRAY_SIZE(link_freq_menu_items);
> > +	const u64 *freqs = link_freq_menu_items;
> > +	unsigned int i, j;
> > +
> > +	for (i = 0; i < freqs_count; i++) {

Ditto.

> > +		for (j = 0; j < ep->nr_of_link_frequencies; j++)
> > +			if (freqs[i] == ep->link_frequencies[j])
> > +				return freqs[i];
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int ov4689_check_hwcfg(struct device *dev)
> > +{
> > +	struct fwnode_handle *fwnode = dev_fwnode(dev);
> > +	struct v4l2_fwnode_endpoint bus_cfg = {
> > +		.bus_type = V4L2_MBUS_CSI2_DPHY,
> > +	};
> > +	struct fwnode_handle *endpoint;
> > +	int ret;
> > +
> > +	endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
> > +	if (!endpoint)
> > +		return -EINVAL;
> > +
> > +	ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &bus_cfg);
> > +	fwnode_handle_put(endpoint);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV4689_LANES) {
> > +		dev_err(dev, "Only a 4-lane CSI2 config is supported");
> > +		ret = -EINVAL;
> > +		goto out_free_bus_cfg;
> > +	}
> > +
> > +	if (!bus_cfg.nr_of_link_frequencies) {
> > +		dev_err(dev, "No link frequencies defined\n");
> > +		ret = -EINVAL;
> > +		goto out_free_bus_cfg;
> > +	}
> 
> As the driver has a single supported freq I wonder if it is required
> to have it mandatory. I got contradictory feedbacks in the past, so
> whatever you have here I guess it's fine (same reasoning goes for dts,
> if there's only one accepted item, does it need to be made mandatory
> ?)

This check could indeed be removed, the one below already handles the case.

The driver can be amended in the future to support additional frequencies.
It probably requires more code here, too...

I've got this in my tree, feel free to send a follow-up patch.

> 
> Nits apart, the driver looks sane
> 
> Reviewed-by: Jacopo Mondi <jacopo@...ndi.org>

Thanks!

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ