From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 9BFC437E2EB; Tue, 28 Apr 2026 15:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777390298; cv=none; b=p/94L6j4Ez1iDtnt1+q6YHjqrPrPcZHS4W5ueUBde7G261GXNehy0YgE6guVAedhH9Smpd6o/AgJgIDhSeGsp5LOnxeC1mAKwVVSkBPHxohn9P7ZBE87KyVNBqMfPzP6vz/LGbw/Ymt81ebyuOE8jpcma3co4g7Si4zh+fXxVpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777390298; c=relaxed/simple; bh=kPrNHRf62C2dlcaoAnjYnpAmywjk6cf+ncxSJYhlzfo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s2L/f4GjpmwPDiEIxNxTPUQuxpRM28p5DUxAT0MMR9fsCOqYOatXlhaQCX35evP4pJSdieO7xVNm5Hrw7lQ/1qcyzT+t4slgXIjEhDRzBYmnGEOTiTh6o3xIuqK/Iso48o2isXDaKisvBQZ9dFvjRdswro+JQ/ydsRv+8aMZaTY= 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=EZJyWCu/; arc=none smtp.client-ip=185.246.85.4 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="EZJyWCu/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 30B0B4E42B54; Tue, 28 Apr 2026 15:31:35 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F173C601D0; Tue, 28 Apr 2026 15:31:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 532FF10728E24; Tue, 28 Apr 2026 17:31:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1777390293; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Z/hooeKY6yKLHzI7T4mV8xmJLrj8AvP17ju7OwRia/4=; b=EZJyWCu/ngaAoeyOw0f/dX73DwGadNCbb+iKAXC48H7vAYdz4WoP9M71ECOB5aNson6Wn+ /SStfy08g1FaWyK2DdQtWdxf2v/Hh9O1xTrjY9aFsobR/DVwQJ5IT+DljXr/U0VxTbJUB5 5MiKhLrD6Bz1z+7osvFoxRCz/Mwt6XPvDH7+TXp50evHX6d/cDeRUTAD+ABtJSrrSj9/1g Xx78IKmKp9WvOb2iHEXh2N9hpDaLAiltws8iIF3fqNuRIkVDlAsfE/Y7ZJMLQv6xD4mYQs uzBU+opjDNx5k+wlhdst9SCU5SmCMFSLbSNXhNrKMkpFlYnYqovXaQivmUTuXQ== From: Luca Ceresoli Date: Tue, 28 Apr 2026 17:30:52 +0200 Subject: [PATCH v3 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: <20260428-drm-bridge-alloc-getput-panel_or_bridge-v3-3-a537b5567add@bootlin.com> References: <20260428-drm-bridge-alloc-getput-panel_or_bridge-v3-0-a537b5567add@bootlin.com> In-Reply-To: <20260428-drm-bridge-alloc-getput-panel_or_bridge-v3-0-a537b5567add@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 , Xinliang Liu , Sumit Semwal , Yongqin Liu , 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 v3: - fix ERR_PTR deref when -ENODEV is returned --- drivers/gpu/drm/msm/hdmi/hdmi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 852abb2466f0..124dedc084ec 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -287,9 +287,13 @@ 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; + hdmi->next_bridge = of_drm_get_bridge_by_endpoint(dev_of_node(dev), 1, 0); + if (IS_ERR(hdmi->next_bridge)) { + if (PTR_ERR(hdmi->next_bridge) == -ENODEV) + hdmi->next_bridge = NULL; + else + return PTR_ERR(hdmi->next_bridge); + } hdmi->mmio = msm_ioremap(pdev, "core_physical"); if (IS_ERR(hdmi->mmio)) @@ -383,6 +387,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