1 From foo@baz Thu May 24 11:09:34 CEST 2018
2 From: Akinobu Mita <akinobu.mita@gmail.com>
3 Date: Mon, 19 Mar 2018 12:14:17 -0400
4 Subject: media: ov5645: add missing of_node_put() in error path
6 From: Akinobu Mita <akinobu.mita@gmail.com>
8 [ Upstream commit 06fe932307d58108a11c3e603517dd2a73a57b80 ]
10 The device node obtained with of_graph_get_next_endpoint() should be
11 released by calling of_node_put(). But it was not released when
12 v4l2_fwnode_endpoint_parse() failed.
14 This change moves the of_node_put() call before the error check and
17 Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
18 Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
19 Acked-by: Todor Tomov <todor.tomov@linaro.org>
20 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
21 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
22 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 drivers/media/i2c/ov5645.c | 5 +++--
26 1 file changed, 3 insertions(+), 2 deletions(-)
28 --- a/drivers/media/i2c/ov5645.c
29 +++ b/drivers/media/i2c/ov5645.c
30 @@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_clien
32 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
35 + of_node_put(endpoint);
38 dev_err(dev, "parsing endpoint node failed\n");
42 - of_node_put(endpoint);
44 if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
45 dev_err(dev, "invalid bus type, must be CSI2\n");