[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1554307455-40361-5-git-send-email-wen.yang99@zte.com.cn>
Date: Thu, 4 Apr 2019 00:04:12 +0800
From: Wen Yang <wen.yang99@....com.cn>
To: linux-kernel@...r.kernel.org
Cc: wang.yi59@....com.cn, Wen Yang <wen.yang99@....com.cn>,
Tomi Valkeinen <tomi.valkeinen@...com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
dri-devel@...ts.freedesktop.org
Subject: [PATCH 4/7] drm/omap: fix possible object reference leak
The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@....com.cn>
Cc: Tomi Valkeinen <tomi.valkeinen@...com>
Cc: David Airlie <airlied@...ux.ie>
Cc: Daniel Vetter <daniel@...ll.ch>
Cc: Sebastian Reichel <sebastian.reichel@...labora.com>
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: dri-devel@...ts.freedesktop.org
Cc: linux-kernel@...r.kernel.org
---
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 2b41c75..60067e8 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -208,8 +208,10 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
- if (dss == NULL || !of_device_is_available(dss))
+ if (dss == NULL || !of_device_is_available(dss)) {
+ of_node_put(dss);
return 0;
+ }
omapdss_walk_device(dss, true);
@@ -234,6 +236,7 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
+ of_node_put(dss);
return 0;
}
--
2.9.5
Powered by blists - more mailing lists