[PATCH] drm/sti: hdmi: Fix bridge leak on component_add() failure
From: Myeonghun Pak
Date: Fri Apr 24 2026 - 08:26:00 EST
sti_hdmi_probe() registers its bridge before adding the component. If
component_add() fails, probe returns the error and leaves the bridge
registered.
The remove callback unregisters the bridge, but remove is only called
after a successful probe. Remove the bridge locally when component_add()
fails, then continue through the existing adapter unwind path.
Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
---
drivers/gpu/drm/sti/sti_hdmi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index f8222e60b1..d7b61b5b35 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1460,9 +1460,15 @@ static int sti_hdmi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hdmi);
drm_bridge_add(&hdmi->bridge);
- return component_add(&pdev->dev, &sti_hdmi_ops);
+ ret = component_add(&pdev->dev, &sti_hdmi_ops);
+ if (ret)
+ goto bridge_remove;
- release_adapter:
+ return 0;
+
+bridge_remove:
+ drm_bridge_remove(&hdmi->bridge);
+release_adapter:
i2c_put_adapter(hdmi->ddc_adapt);
return ret;
--
2.50.1