]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: ov5645: add missing of_node_put() in error path
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 19 Mar 2018 16:14:17 +0000 (12:14 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:29:35 +0000 (12:29 +0200)
BugLink: http://bugs.launchpad.net/bugs/1783418
[ Upstream commit 06fe932307d58108a11c3e603517dd2a73a57b80 ]

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: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/i2c/ov5645.c

index d6392953117ab5454f865c8795869430560d9758..a74fa5a837c3aaf394bd15242da2c57c09992d11 100644 (file)
@@ -1230,13 +1230,14 @@ static int ov5645_probe(struct i2c_client *client,
 
        ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
                                         &ov5645->ep);
+
+       of_node_put(endpoint);
+
        if (ret < 0) {
                dev_err(dev, "parsing endpoint node failed\n");
                return ret;
        }
 
-       of_node_put(endpoint);
-
        if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
                dev_err(dev, "invalid bus type, must be CSI2\n");
                return -EINVAL;