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;