]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/sti: remove bridge when sti_hda component_add fails
authorOsama Abdelkader <osama.abdelkader@gmail.com>
Thu, 23 Apr 2026 20:06:19 +0000 (22:06 +0200)
committerRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Mon, 4 May 2026 20:52:39 +0000 (22:52 +0200)
Use devm_drm_bridge_add() so the bridge is released if probe fails after
registration, and drop the manual drm_bridge_remove() in remove().

Check the return value of devm_drm_bridge_add().

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Fixes: d28726efc637 ("drm/sti: hda: add bridge before attaching")
Cc: stable@vger.kernel.org
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Raphaƫl Gallais-Pou <rgallaispou@gmail.com>
Link: https://patch.msgid.link/20260423200622.325076-1-osama.abdelkader@gmail.com
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
drivers/gpu/drm/sti/sti_hda.c

index b7397827889c94d6f8e8c2a48b09f06e29ceeaf7..360a88ca8f0c5a5ed709b42a921ed4ed0a3221a2 100644 (file)
@@ -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__);
 
@@ -779,7 +780,9 @@ static int sti_hda_probe(struct platform_device *pdev)
                return PTR_ERR(hda->clk_hddac);
        }
 
-       drm_bridge_add(&hda->bridge);
+       ret = devm_drm_bridge_add(dev, &hda->bridge);
+       if (ret)
+               return ret;
 
        platform_set_drvdata(pdev, hda);
 
@@ -788,10 +791,7 @@ static int sti_hda_probe(struct platform_device *pdev)
 
 static void sti_hda_remove(struct platform_device *pdev)
 {
-       struct sti_hda *hda = platform_get_drvdata(pdev);
-
        component_del(&pdev->dev, &sti_hda_ops);
-       drm_bridge_remove(&hda->bridge);
 }
 
 static const struct of_device_id hda_of_match[] = {