Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: hdmi: put bridge reference on probe failure
@ 2026-11-26  5:58 Yige Jiang
  2026-11-26 13:37 ` Luca Ceresoli
  0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-26  5:58 UTC (permalink / raw)
  To: Inki Dae, Seung-Woo Kim, Kyungmin Park
  Cc: Yige Jiang, David Airlie, Simona Vetter, Krzysztof Kozlowski,
	Peter Griffin, Alim Akhtar, Luca Ceresoli, Marek Szyprowski,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	stable

hdmi_resources_init() ends with hdmi_bridge_init(), which takes a
reference on the next bridge with of_drm_find_and_get_bridge(). That
reference is only dropped in hdmi_remove(). When hdmi_probe() fails
after hdmi_resources_init(), including the -EPROBE_DEFER returns for
the DDC adapter, the PHY and the syscon lookups, the reference is
leaked, once per failed probe attempt.

The sashiko AI review bot pointed this out on dri-devel on 2026-07-16,
in its review of an unrelated exynos_hdmi patch.

Drop the reference at the end of the probe error path and route the two
early returns after hdmi_resources_init() through it. drm_bridge_put()
ignores NULL, which covers boards without a bridge on port 1.

Fixes: 2db0d298f22d ("drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20260716132919.A3EA81F000E9@smtp.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_DRM_EXYNOS=m, CONFIG_DRM_EXYNOS_HDMI=y, CONFIG_DRM_EXYNOS_MIXER=y, CONFIG_COMPILE_TEST=y; baseline and patched exynos_hdmi.o, no new warnings.
No hardware or runtime test was performed.
The path needs a bridge on HDMI port 1 and a later probe failure or deferral, e.g. a DDC adapter or PHY that is not ready yet.

 drivers/gpu/drm/exynos/exynos_hdmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d67a493c8fe4..cf570be8fdc3 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1997,12 +1997,12 @@ static int hdmi_probe(struct platform_device *pdev)
 	hdata->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hdata->regs)) {
 		ret = PTR_ERR(hdata->regs);
-		return ret;
+		goto err_bridge;
 	}
 
 	ret = hdmi_get_ddc_adapter(hdata);
 	if (ret)
-		return ret;
+		goto err_bridge;
 
 	ret = hdmi_get_phy_io(hdata);
 	if (ret)
@@ -2079,6 +2079,8 @@ static int hdmi_probe(struct platform_device *pdev)
 		iounmap(hdata->regs_hdmiphy);
 err_ddc:
 	i2c_put_adapter(hdata->ddc_adpt);
+err_bridge:
+	drm_bridge_put(hdata->bridge);
 
 	return ret;
 }

base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/exynos: hdmi: put bridge reference on probe failure
  2026-11-26  5:58 [PATCH] drm/exynos: hdmi: put bridge reference on probe failure Yige Jiang
@ 2026-11-26 13:37 ` Luca Ceresoli
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Ceresoli @ 2026-11-26 13:37 UTC (permalink / raw)
  To: Yige Jiang, Inki Dae, Seung-Woo Kim, Kyungmin Park
  Cc: David Airlie, Simona Vetter, Krzysztof Kozlowski, Peter Griffin,
	Alim Akhtar, Luca Ceresoli, Marek Szyprowski, dri-devel,
	linux-arm-kernel, linux-samsung-soc, linux-kernel, stable

On Thu Nov 26, 2026 at 6:58 AM CET, Yige Jiang wrote:
> hdmi_resources_init() ends with hdmi_bridge_init(), which takes a
> reference on the next bridge with of_drm_find_and_get_bridge(). That
> reference is only dropped in hdmi_remove(). When hdmi_probe() fails
> after hdmi_resources_init(), including the -EPROBE_DEFER returns for
> the DDC adapter, the PHY and the syscon lookups, the reference is
> leaked, once per failed probe attempt.
>
> The sashiko AI review bot pointed this out on dri-devel on 2026-07-16,
> in its review of an unrelated exynos_hdmi patch.
>
> Drop the reference at the end of the probe error path and route the two
> early returns after hdmi_resources_init() through it. drm_bridge_put()
> ignores NULL, which covers boards without a bridge on port 1.
>
> Fixes: 2db0d298f22d ("drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20260716132919.A3EA81F000E9@smtp.kernel.org
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-26 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  5:58 [PATCH] drm/exynos: hdmi: put bridge reference on probe failure Yige Jiang
2026-11-26 13:37 ` Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox