From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60389388398; Thu, 7 May 2026 13:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778161561; cv=none; b=jMBWUo5/R9PmnnpK9OGyG8Lw59yp3MnCb5SbV98v5fqYe8Emhh/5Sb/BKWS3BZgMfWDghvFWmosROy4CZYO38Sa+Ru/GoeqQ/7mRhs3FWobFwJ4sMxMaQ2kmuAllNCUV/eLwy0ZY7hO+lCvNADSWCxD+BjNmRr1ribhOqFMS0Ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778161561; c=relaxed/simple; bh=YU4W10QZOyvlqiJ44v/3rj0oAfMtEBv8LCCv8Og1kCs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qfCS4OQ/VJ5/i6pQAgUWB7Xi+m11D/waMeXC0wQTOm8f5tB2Ya6L3774nfdsfe3fGnvgb2jNA9H1perL34Rb9qaTIz4eBwYYMuBV+NzMdTDbTB8i4K2ctIWC2xp+rbXm/xupvl5FqKOU+ce87mfy+1BJLaoVd6EHomGkzXGqxBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=I70fN5yp; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="I70fN5yp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 171571A355C; 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() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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