From patchwork Sat Oct 22 07:23:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7594 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106358wrr; Sat, 22 Oct 2022 01:37:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45bUvOqtAzyTXPRskjp+0WTEAV+tPHj5rWEWp2y9FeA+JIbzom4/+xCulCZD5E/AhtosoM X-Received: by 2002:a05:6a00:e1b:b0:537:7c74:c405 with SMTP id bq27-20020a056a000e1b00b005377c74c405mr23428047pfb.43.1666427859303; Sat, 22 Oct 2022 01:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427859; cv=none; d=google.com; s=arc-20160816; b=IzQOc9pis7NBljHUY/yZJM4yXoNu5y1zv8kKaXbmhKS/YlCoM7FEVBGp6UM5oBVUU2 hO9T9C825EzO2e0oJy2uOap/JbYm+XoBUbyUSV5WpXHOBOeTRdOkOAdoXsrF9nAylOwQ QgsSepjV5f3YO4qCaqHhlNEjzY3HDr7h1G32pLpU7chTaAD/0I+jbMSIkk2kDVMByWpM rxzDWLASi44IFQvPbPRH57nDxNYap6t6FM8E8BMjS5leqcQOnLxwVYNdZ9T2nDCBg9pf WgqIKjnTXjGq3kVU95fpITqMBWuFnpTd8yIDwzb3wKXjidXKyKLYWCdSJYuaPR1rTmhk 1fZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lmXJQqyWmTSjH0uKNwuqzSY2rFXV/thledKDzAAKiVY=; b=031DVTlpSu4MbXv4BQX5DFF+EjsoFSAWzdJHXV6KChJtd+QVf+HRbCCgVWus8YYnpz YRsmiG9C5u1c3bs99rwQi1vpN6bduZYettGpI+ZxnW4QkeV0SjZDXhv9RETOqX5NXMsD 9hJVQEa46fkw+BAD7bv3rHrBKqg3p0tJ4qVefxvFQ0vd5r2e8wbKx94EOrnE5k9I1KfP LY8wQgFOvqqEguFhlOq4l99qoWqVO5P6YuujYLRgoqkcGe+nff82KoOiwHp1ViV9ZJ7Y H2DRyTvwy7DVvRuBi3Iw7f5iGP7MXhjO2J3vScyRY/RT/nQ9ytAaOGzceOUThSFFyzdW eK6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DEUkwU0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020aa79acb000000b0054875fd979bsi24550310pfp.216.2022.10.22.01.37.26; Sat, 22 Oct 2022 01:37:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DEUkwU0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233735AbiJVIZ4 (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233960AbiJVIYZ (ORCPT ); Sat, 22 Oct 2022 04:24:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E24A34720; Sat, 22 Oct 2022 00:59:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 433B860B00; Sat, 22 Oct 2022 07:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A942C433C1; Sat, 22 Oct 2022 07:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424933; bh=OrgKGO73y1B/u0tS6QRxRrNmb9qgT0q8a/QBwrZrYSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEUkwU0pLF9jawIfsoRIkJa5N/ZcgZNmSqmrUCaowq4v2ytuAqBmeP8JGEmZiQGne YY4vtGE6ko95LYgc1x1zvTDpLKbFEhotcUIcTz+0YLCQ4igHeqygjOmxr82W5HcKQ+ pRh8ZdxLYBE5cvi1SRf2PQz5sEs1T8QeTPbMB8vM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Foss , Sasha Levin Subject: [PATCH 5.19 301/717] drm/bridge: tc358767: Add of_node_put() when breaking out of loop Date: Sat, 22 Oct 2022 09:23:00 +0200 Message-Id: <20221022072506.211730742@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376258812469993?= X-GMAIL-MSGID: =?utf-8?q?1747376258812469993?= From: Liang He [ 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 Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/tc358767.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 16affb42086a..c41c6c464b7f 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -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); }