Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363764

Re: [RFT PATCH] [media] exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling

From Andreas Färber <afaerber@suse.de>
Newsgroups linux.kernel
Subject Re: [RFT PATCH] [media] exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling
Date 2016-03-23 23:40 +0100
Message-ID <rfZBv-1Fl-3@gated-at.bofh.it> (permalink)
References <rfTFM-60M-11@gated-at.bofh.it>
Organization SUSE Linux GmbH

Show all headers | View raw


Hi Javier,

Am 23.03.2016 um 17:15 schrieb Javier Martinez Canillas:
> The same struct device_node * is used for looking up the I2C sensor, OF
> graph endpoint and port. So the reference count is incremented but not
> decremented for the endpoint and port nodes.
> 
> Fix this by having separate pointers for each node looked up.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
[...]
> diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
> index 979c388ebf60..0b04a5d25187 100644
> --- a/drivers/media/platform/exynos4-is/fimc-is.c
> +++ b/drivers/media/platform/exynos4-is/fimc-is.c
> @@ -165,6 +165,7 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,
>  						struct device_node *node)
>  {
>  	struct fimc_is_sensor *sensor = &is->sensor[index];
> +	struct device_node *ep, *port;
>  	u32 tmp = 0;
>  	int ret;
>  
> @@ -175,16 +176,18 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,
>  		return -EINVAL;
>  	}
>  
> -	node = of_graph_get_next_endpoint(node, NULL);
> -	if (!node)
> +	ep = of_graph_get_next_endpoint(node, NULL);
> +	if (!ep)
>  		return -ENXIO;
>  
> -	node = of_graph_get_remote_port(node);
> -	if (!node)
> +	port = of_graph_get_remote_port(ep);
> +	of_node_put(ep);
> +	if (!port)
>  		return -ENXIO;
>  
>  	/* Use MIPI-CSIS channel id to determine the ISP I2C bus index. */
> -	ret = of_property_read_u32(node, "reg", &tmp);
> +	ret = of_property_read_u32(port, "reg", &tmp);
> +	of_node_put(port);
>  	if (ret < 0) {
>  		dev_err(&is->pdev->dev, "reg property not found at: %s\n",
>  							 node->full_name);

port->full_name. You'll need to defer the of_node_put(port) then.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFT PATCH] [media] exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling Javier Martinez Canillas <javier@osg.samsung.com> - 2016-03-23 17:20 +0100
  Re: [RFT PATCH] [media] exynos4-is: Fix fimc_is_parse_sensor_config()  nodes handling Andreas Färber <afaerber@suse.de> - 2016-03-23 23:40 +0100
    Re: [RFT PATCH] [media] exynos4-is: Fix fimc_is_parse_sensor_config()  nodes handling Javier Martinez Canillas <javier@osg.samsung.com> - 2016-03-24 01:40 +0100

csiph-web