[PATCH] drm/sti: hdmi: remove bridge when component_add fails
From: Osama Abdelkader
Date: Fri Apr 10 2026 - 15:44:56 EST
when component_add fails in sti_hdmi_probe remove the drm bridge
and put i2c adapter before return
Signed-off-by: Osama Abdelkader <osama.abdelkader@xxxxxxxxx>
---
drivers/gpu/drm/sti/sti_hdmi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index f8222e60b1e0..839c80a7d954 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1460,8 +1460,13 @@ 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 remove_bridge;
+ return 0;
+ remove_bridge:
+ drm_bridge_remove(&hdmi->bridge);
release_adapter:
i2c_put_adapter(hdmi->ddc_adapt);
--
2.43.0