Commit 06fe9323 authored by Akinobu Mita's avatar Akinobu Mita Committed by Mauro Carvalho Chehab

media: ov5645: add missing of_node_put() in error path

The device node obtained with of_graph_get_next_endpoint() should be
released by calling of_node_put().  But it was not released when
v4l2_fwnode_endpoint_parse() failed.

This change moves the of_node_put() call before the error check and
fixes the issue.

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarTodor Tomov <todor.tomov@linaro.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent e6441fde
...@@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client, ...@@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client,
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
&ov5645->ep); &ov5645->ep);
of_node_put(endpoint);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "parsing endpoint node failed\n"); dev_err(dev, "parsing endpoint node failed\n");
return ret; return ret;
} }
of_node_put(endpoint);
if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) { if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
dev_err(dev, "invalid bus type, must be CSI2\n"); dev_err(dev, "invalid bus type, must be CSI2\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment