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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 1 Aug 2020 03:59:10 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Sowjanya Komatineni <skomatineni@...dia.com>,
        thierry.reding@...il.com, jonathanh@...dia.com, frankc@...dia.com,
        hverkuil@...all.nl, sakari.ailus@....fi, robh+dt@...nel.org,
        helen.koike@...labora.com
Cc:     gregkh@...uxfoundation.org, linux-media@...r.kernel.org,
        devicetree@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 06/10] media: tegra-video: Add support for external
 sensor capture

01.08.2020 00:32, Sowjanya Komatineni пишет:
...
> +static int tegra_csi_channels_alloc(struct tegra_csi *csi)
> +{
> +	struct device_node *node = csi->dev->of_node;
> +	struct v4l2_fwnode_endpoint v4l2_ep = {
> +		.bus_type = V4L2_MBUS_CSI2_DPHY
> +	};
> +	struct fwnode_handle *fwh;
> +	struct device_node *channel;
> +	struct device_node *ep;
> +	unsigned int lanes, portno, num_pads;
> +	int ret;
> +
> +	for_each_child_of_node(node, channel) {
> +		if (!of_node_name_eq(channel, "channel"))
> +			continue;
> +
> +		ret = of_property_read_u32(channel, "reg", &portno);
> +		if (ret < 0)
> +			continue;
> +
> +		if (portno >= csi->soc->csi_max_channels) {
> +			dev_err(csi->dev, "invalid port num %d\n", portno);

The "channel" node should be put on error.

> +			return -EINVAL;
> +		}
> +
> +		ep = of_graph_get_endpoint_by_regs(channel, 0, 0);
> +		if (!ep)
> +			continue;
> +
> +		fwh = of_fwnode_handle(ep);
> +		ret = v4l2_fwnode_endpoint_parse(fwh, &v4l2_ep);
> +		of_node_put(ep);
> +		if (ret) {
> +			dev_err(csi->dev,
> +				"failed to parse v4l2 endpoint: %d\n", ret);
> +			return ret;
> +		}
> +
> +		lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
> +		if (!lanes || ((lanes & (lanes - 1)) != 0)) {
> +			dev_err(csi->dev, "invalid data-lanes %d\n", lanes);
> +			return -EINVAL;
> +		}
> +
> +		num_pads = of_graph_get_endpoint_count(channel);
> +		if (num_pads == TEGRA_CSI_PADS_NUM) {
> +			ret = tegra_csi_channel_alloc(csi, channel, portno,
> +						      lanes, num_pads);
> +			if (ret < 0)
> +				return ret;
> +		}
>  	}
...
> +static int tegra_vi_channels_alloc(struct tegra_vi *vi)
> +{
> +	struct device_node *node = vi->dev->of_node;
> +	struct device_node *ep = NULL;
> +	struct device_node *ports;
> +	struct device_node *port;
> +	unsigned int port_num;
> +	int ret;
> +
> +	ports = of_get_child_by_name(node, "ports");
> +	if (!ports)
> +		return -ENODEV;
> +
> +	for_each_child_of_node(ports, port) {
> +		if (!of_node_name_eq(port, "port"))
> +			continue;
> +
> +		ret = of_property_read_u32(port, "reg", &port_num);
> +		if (ret < 0)
> +			continue;
> +
> +		if (port_num > vi->soc->vi_max_channels) {
> +			of_node_put(ports);

s/ports/port/

> +			dev_err(vi->dev, "invalid port num %d\n", port_num);
> +			return -EINVAL;
> +		}
> +
> +		ep = of_get_child_by_name(port, "endpoint");
> +		if (!ep)
> +			continue;
> +
> +		of_node_put(ep);
> +		ret = tegra_vi_channel_alloc(vi, port_num, port);
> +		if (ret < 0) {
> +			of_node_put(ports);
s/ports/port/

> +			return ret;
> +		}
>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ