ARM: OMAP2+: Fix refcount leak in omapdss_init_of
Subsystems (3)
PATCH 1/1 ARM: OMAP2+: Fix refcount leak in omapdss_init_of
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.
--- arch/arm/mach-omap2/display.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/display.c +2 -0
@@ -259,11 +259,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;
Signature · 1 line
2.25.1
Hello Lin,
Thank you for the patch.
Quoted 7 lines · Miaoqian Lin
omapdss_find_dss_of_node()callsof_find_compatible_node()to get device node.of_find_compatible_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when done. Add missingof_node_put()in later error path and normal path.Fixes e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")Signed-off-by Miaoqian Lin <[email protected]>
Quoted 22 lines
--- arch/arm/mach-omap2/display.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm/mach-omap2/display.c +2
-0@@ -259,11 +259,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;
Signature · 3 lines
Regards, Laurent Pinchart
Tony Lindgren
maintainerQuoted 10 lines · Laurent Pinchart
Hello Lin,
Thank you for the patch.
Quoted 5 lines · Miaoqian Lin
omapdss_find_dss_of_node()callsof_find_compatible_node()to get device node.of_find_compatible_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when done. Add missingof_node_put()in later error path and normal path.
Quoted 4 lines
Quoted 2 lines
Fixes e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver")Signed-off-by Miaoqian Lin <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
Thanks applying this into omap-for-v5.20/soc.
Regards,
Tony