提交 e6bb51b0 编写于 作者: J Julia Lawall 提交者: Zheng Zengkai

drm/of: free the right object

stable inclusion
from stable-5.10.65
commit 56e5c527cc2edffe7afd9fa6a6d8bc285c1c599b
bugzilla: 182361 https://gitee.com/openeuler/kernel/issues/I4EH3U

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=56e5c527cc2edffe7afd9fa6a6d8bc285c1c599b

--------------------------------

[ Upstream commit b557a5f8 ]

There is no need to free a NULL value.  Instead, free the object
that is leaking due to the iterator.

The semantic patch that finds this problem is as follows:

// <smpl>
@@
expression x,e;
identifier f;
@@
 x = f(...);
 if (x == NULL) {
	... when any
	    when != x = e
*	of_node_put(x);
	...
 }
// </smpl>

Fixes: 65290075 ("drm: of: Add drm_of_lvds_get_dual_link_pixel_order")
Signed-off-by: NJulia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210709200717.3676376-1-Julia.Lawall@inria.frSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 bb26f6a7
...@@ -315,7 +315,7 @@ static int drm_of_lvds_get_remote_pixels_type( ...@@ -315,7 +315,7 @@ static int drm_of_lvds_get_remote_pixels_type(
remote_port = of_graph_get_remote_port(endpoint); remote_port = of_graph_get_remote_port(endpoint);
if (!remote_port) { if (!remote_port) {
of_node_put(remote_port); of_node_put(endpoint);
return -EPIPE; return -EPIPE;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册