Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1020701rwi; Wed, 19 Oct 2022 05:56:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JBH/f+emDt6bw0AkvDGgGr1hgcawjBVbVeolOIbVZkJsAznfKbdq3ZbI/u2keMj7Ay9iO X-Received: by 2002:a17:907:d9e:b0:78e:2ff7:72f4 with SMTP id go30-20020a1709070d9e00b0078e2ff772f4mr6388038ejc.608.1666184200793; Wed, 19 Oct 2022 05:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184200; cv=none; d=google.com; s=arc-20160816; b=uGGJ/KcAMOSE8owXQ3cq8SPsMjM3bBGprziRwPkjFJiVGep2Yjo7O3tDrx7g5Ki8KE aU3niDGUOWuPIWJeYEcLSe091x88jkIL8W9GKDXqmM0h9Ziq4ss6OCnPIZ5CBbfuSZpo xS6AZodAOGW8PRHnekrvy7Us9tU10/N3xZkK2qU0A9+iLvJ1UvYDXbZfhYkq7/c2seEy XoT/BrL4+uQrSdWnZxyZGlYGv+LORYzHa1GY3LcLOEi4CKepI+7UwU4URlAGAeZsRnm/ LW6rV+hqIb/pnShhfew5qRrYsNQO5kXdVGNAL6akRrQPcVKMiaupTiJHGSAE73Czg2Ze /LuA== 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=MziyT5vg+H67whEHrQd9zuEHgG49Q9pMI1vq7fFIVYg=; b=Geivz/Sv8pAi2nDbR2C+cXP02kan90FFSbzDyNW4HJfdm2KAwpGiSjMHhvC9dQYJFD coNFjIE+C9C+eMzBqS24B+wE/pF2OgWfYi6zASmn/g1qi7xxkEvaCoejzcN0/P/jigjJ OLOWUp7zEpWkoX1/PtUt3NcZfiT/0dJvFDkz6el6r/uaPOGou3yWMhoCuxR/7znaskTe xP/n+y481FSADilmzcqXQEuWSBu5LXBz4zguKUblFsFE7CHpxiBOqiFn7hJrzxy2X8hK EO2pWjgkwM3OYNXRfu8c9q4HGQb+FFTEVufe9IQNSQqb77cLlINCqvqjf5UCM7W2DrpF JIUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IxRqG3Ag; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd23-20020a1709076e1700b007414886601asi13333245ejc.25.2022.10.19.05.56.14; Wed, 19 Oct 2022 05:56:40 -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=IxRqG3Ag; 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 S232387AbiJSMAj (ORCPT + 99 others); Wed, 19 Oct 2022 08:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231989AbiJSL7c (ORCPT ); Wed, 19 Oct 2022 07:59:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185A0181C99; Wed, 19 Oct 2022 04:37:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id CE73AB823C0; Wed, 19 Oct 2022 08:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48E8CC433C1; Wed, 19 Oct 2022 08:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169645; bh=GcEtVsWKnpmNwwgXJ7eWwXOSgwnZJUIhbPIQKSK6ZAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IxRqG3Ag8oO8yLR8KjzoEmSKE6gmd8kPAJVYNGeL9bRMGOH44KtcKw4mu3dtXba0d qQCVsYoaiEwyi1RXF3dL4voRzIb6tslXxpNlWevynQkes77uAuGQ1SM4OAvgQnnyGF 3Rhokjuzk2smQ5qBk5m90Zgbop1NJKaf3n7SPJI4= 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 6.0 355/862] drm/bridge: tc358767: Add of_node_put() when breaking out of loop Date: Wed, 19 Oct 2022 10:27:22 +0200 Message-Id: <20221019083305.720386538@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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 02bd757a8987..1dc107f13645 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -2010,9 +2010,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); } -- 2.35.1