]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ARM: OMAP2+: Fix refcount leak in omapdss_init_of
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 1 Jun 2022 04:48:58 +0000 (08:48 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:15:34 +0000 (15:15 +0200)
[ Upstream commit 9705db1eff38d6b9114121f9e253746199b759c9 ]

omapdss_find_dss_of_node() calls of_find_compatible_node() to get device
node. of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() in later error path and normal path.

Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Message-Id: <20220601044858.3352-1-linmq006@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-omap2/display.c

index fc635eed73abb34d4d02ea772753a93e5202c97b..f24d4e56ddfc2d92f3406438d1b88adcbdd3871c 100644 (file)
@@ -260,11 +260,13 @@ static int __init omapdss_init_of(void)
 
        if (!pdev) {
                pr_err("Unable to find DSS platform device\n");
+               of_node_put(node);
                return -ENODEV;
        }
 
        r = of_platform_populate(node, NULL, NULL, &pdev->dev);
        put_device(&pdev->dev);
+       of_node_put(node);
        if (r) {
                pr_err("Unable to populate DSS submodule devices\n");
                return r;