* [PATCH] drm: of: fix a potential double put bug
@ 2022-04-19 12:14 Ziyang Xuan
2022-04-29 9:44 ` Ziyang Xuan
0 siblings, 1 reply; 2+ messages in thread
From: Ziyang Xuan @ 2022-04-19 12:14 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
dri-devel, linux-kernel
Execute the following coccinelle rule:
$make coccicheck COCCI=scripts/coccinelle/iterators/device_node_continue.cocci
Get an error report as following:
./drivers/gpu/drm/drm_of.c:292:2-13: ERROR: probable double put.
Device node iterators put the previous value of the index variable,
when find_panel_or_bridge() return non-zero, it will causes a double put.
Fixes: 67bae5f28c89 ("drm: of: Properly try all possible cases for bridge/panel detection")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
drivers/gpu/drm/drm_of.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index f4df344509a8..8c3c0bca1af1 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -289,11 +289,12 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
continue;
ret = find_panel_or_bridge(node, panel, bridge);
- of_node_put(node);
/* Stop at the first found occurrence. */
- if (!ret)
+ if (!ret) {
+ of_node_put(node);
return 0;
+ }
}
return -EPROBE_DEFER;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: of: fix a potential double put bug
2022-04-19 12:14 [PATCH] drm: of: fix a potential double put bug Ziyang Xuan
@ 2022-04-29 9:44 ` Ziyang Xuan
0 siblings, 0 replies; 2+ messages in thread
From: Ziyang Xuan @ 2022-04-29 9:44 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel, dri-devel
Cc: william.xuanziyang
Is there any comments about the path?
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-29 9:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 12:14 [PATCH] drm: of: fix a potential double put bug Ziyang Xuan
2022-04-29 9:44 ` Ziyang Xuan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.