]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.44/media-ov5645-add-missing-of_node_put-in-error-path.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.44 / media-ov5645-add-missing-of_node_put-in-error-path.patch
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
5
6 From: Akinobu Mita <akinobu.mita@gmail.com>
7
8 [ Upstream commit 06fe932307d58108a11c3e603517dd2a73a57b80 ]
9
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.
13
14 This change moves the of_node_put() call before the error check and
15 fixes the issue.
16
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>
24 ---
25 drivers/media/i2c/ov5645.c | 5 +++--
26 1 file changed, 3 insertions(+), 2 deletions(-)
27
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
31
32 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
33 &ov5645->ep);
34 +
35 + of_node_put(endpoint);
36 +
37 if (ret < 0) {
38 dev_err(dev, "parsing endpoint node failed\n");
39 return ret;
40 }
41
42 - of_node_put(endpoint);
43 -
44 if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
45 dev_err(dev, "invalid bus type, must be CSI2\n");
46 return -EINVAL;