Re: [PATCH 1/3] drm/sti: remove bridge when sti_hda component_add fails

From: Luca Ceresoli

Date: Tue Apr 14 2026 - 03:36:38 EST


On Fri Apr 10, 2026 at 11:27 PM CEST, Osama Abdelkader wrote:
> when component_add fails in sti_hda_probe remove drm
> bridge before return
>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@xxxxxxxxx>
> ---
> drivers/gpu/drm/sti/sti_hda.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index b7397827889c..1b4ba9097005 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -741,6 +741,7 @@ static int sti_hda_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct sti_hda *hda;
> struct resource *res;
> + int ret;
>
> DRM_INFO("%s\n", __func__);
>
> @@ -783,7 +784,10 @@ static int sti_hda_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, hda);
>
> - return component_add(&pdev->dev, &sti_hda_ops);
> + ret = component_add(&pdev->dev, &sti_hda_ops);
> + if (ret)
> + drm_bridge_remove(&hda->bridge);
> + return ret;
> }

At a quick look it seems that you can simply use devm_drm_bridge_add() in
all the three drivers in this series.

Luca

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