diff options
author | Javier Martinez Canillas <javier@osg.samsung.com> | 2016-03-24 03:41:40 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-08-24 19:31:09 +0300 |
commit | 4f355cb5676039b98232bb86d4ed1542eaa9e0be (patch) | |
tree | e1e175e3a34169798ba5a87d3583dc3c60d8318b /drivers/media/platform/exynos4-is/fimc-is.c | |
parent | 3b2aa383b3bc4e16ee15a145f8d9575a73779337 (diff) | |
download | linux-4f355cb5676039b98232bb86d4ed1542eaa9e0be.tar.xz |
[media] exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling
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>
Tested-by: Nicolas Dufresne <nicoas.dufresne@collabora.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/exynos4-is/fimc-is.c')
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 32ca55f16677..13c779de79fd 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,22 +176,25 @@ 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); if (ret < 0) { dev_err(&is->pdev->dev, "reg property not found at: %s\n", - node->full_name); + port->full_name); + of_node_put(port); return ret; } + of_node_put(port); sensor->i2c_bus = tmp - FIMC_INPUT_MIPI_CSI2_0; return 0; } |