]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/bridge: tc358767: Add of_node_put() when breaking out of loop
authorLiang He <windhl@126.com>
Tue, 19 Jul 2022 06:54:47 +0000 (14:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:57:17 +0000 (09:57 +0200)
[ Upstream commit 14e7157afb055248ed34901fcd6fbf54201cfea1 ]

In tc_probe_bridge_endpoint(), we should call of_node_put() when
breaking out of the for_each_endpoint_of_node() which will automatically
increase and decrease the refcount.

Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT")
Signed-off-by: Liang He <windhl@126.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-2-windhl@126.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/bridge/tc358767.c

index 16affb42086ad1911aa8658cd632311be492bff8..c41c6c464b7fc5cfb8d46804b92c3bda66c3196a 100644 (file)
@@ -1986,9 +1986,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)
 
        for_each_endpoint_of_node(dev->of_node, node) {
                of_graph_parse_endpoint(node, &endpoint);
-               if (endpoint.port > 2)
+               if (endpoint.port > 2) {
+                       of_node_put(node);
                        return -EINVAL;
-
+               }
                mode |= BIT(endpoint.port);
        }