From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C5C1CD3439 for ; Thu, 7 May 2026 13:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RtzP57UXUm85OPkvizoSGXF1wAN47TiL0RnGW2p7TxY=; b=i6qgNaq2FClW8fqqBQv2DczRzk yCK9tgm9ALSqVU3na5o82Wzdd/QFi+hS/yZ3n02xECauZFP8bENyZlqIE2Jy5iAe+G0NpsC9TXfLc HuSbJNRv/5QCW/EO6ddOEp5YJE4AA/XDlAZzcusT2nBRlf8LfkCgG2hhmbM/iDmEAkD0/z5hDnzO0 8wmRYBaAhabFkPmROb8ikEbLHV5DuMeXtDRJUqKstnD+80fSI920i9r1eJilfFyfT1jY0aMFUsnaF OaXcZAp1V7F5lT9cfpBpFXST7dXITUuqV7uDDjW+7+zKhKamla9i3ovQvbCzaoMVc8u2ZXEbSINSQ 86fLzY2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKz3C-00000003wpB-02sU; Thu, 07 May 2026 13:46:02 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKz39-00000003wn6-2AOI for linux-arm-kernel@lists.infradead.org; Thu, 07 May 2026 13:46:00 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 1EA114E42C31; Thu, 7 May 2026 13:45:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DE06E60495; Thu, 7 May 2026 13:45:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E2ACD108194AE; Thu, 7 May 2026 15:45:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1778161556; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=RtzP57UXUm85OPkvizoSGXF1wAN47TiL0RnGW2p7TxY=; b=I70fN5ypih0XjYhzsQvcof/74Ijv7zwpyhaaEfqKbQ/tBh9dsGEz1lmBOsajlDpOmPsQiu n4taQqavyWRH/IaRZm+efBklRheKiFAUP1vNI5NKRf5CxbQMA0Yn/0kMPIsUqplLE6dSTM frR4kS1nnVaEs3AuJL8gIv+grBuJBo2i8MxZPQD3VkXhu8c+1TgU1ihVP6M6bx7bUt9Mvt fs8GNKzmKCCgSzubZy8FO0TzNLBJuQMV0khAGrePDehQoXHWQIKTkifuUtGe+VcBvZATwO rUp2BtGiy6QPbl8ZTDKd65qiX/aa4QSClx1drEaOXcFu02fCweCjmDR8MMZqbQ== From: Luca Ceresoli Date: Thu, 07 May 2026 15:45:21 +0200 Subject: [PATCH v5 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260507-drm-bridge-alloc-getput-panel_or_bridge-v5-3-472b913b5cb7@bootlin.com> References: <20260507-drm-bridge-alloc-getput-panel_or_bridge-v5-0-472b913b5cb7@bootlin.com> In-Reply-To: <20260507-drm-bridge-alloc-getput-panel_or_bridge-v5-0-472b913b5cb7@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Sumit Semwal , John Stultz , Tomi Valkeinen , Michal Simek Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Luca Ceresoli X-Mailer: b4 0.15.2 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260507_064559_703942_49C89B38 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the @panel parameter, thus using a reduced feature set of that function. Replace this call with the simpler of_drm_get_bridge_by_endpoint(). Since of_drm_get_bridge_by_endpoint() increases the refcount of the returned bridge, ensure it is put on removal. Signed-off-by: Luca Ceresoli --- Changes in v5: - simplify error management code flow Changes in v4: - ensure next_bridge is put on later probe failures Changes in v3: - fix ERR_PTR deref when -ENODEV is returned --- drivers/gpu/drm/msm/hdmi/hdmi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index d9491aac1a89..3640be8c1bf9 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -285,9 +285,14 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) spin_lock_init(&hdmi->reg_lock); mutex_init(&hdmi->state_mutex); - ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge); - if (ret && ret != -ENODEV) - return ret; + struct drm_bridge *next_bridge __free(drm_bridge_put) = + of_drm_get_bridge_by_endpoint(dev_of_node(dev), 1, 0); + if (IS_ERR(next_bridge)) { + if (PTR_ERR(next_bridge) != -ENODEV) + return PTR_ERR(next_bridge); + + next_bridge = NULL; + } hdmi->mmio = msm_ioremap(pdev, "core_physical"); if (IS_ERR(hdmi->mmio)) @@ -367,6 +372,8 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) if (ret) goto err_put_phy; + hdmi->next_bridge = no_free_ptr(next_bridge); + return 0; err_put_phy: @@ -381,6 +388,7 @@ static void msm_hdmi_dev_remove(struct platform_device *pdev) component_del(&pdev->dev, &msm_hdmi_ops); msm_hdmi_put_phy(hdmi); + drm_bridge_put(hdmi->next_bridge); } static int msm_hdmi_runtime_suspend(struct device *dev) -- 2.53.0