]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/bridge: megachips: remove bridge when irq request fails
authorOsama Abdelkader <osama.abdelkader@gmail.com>
Thu, 30 Apr 2026 19:56:59 +0000 (21:56 +0200)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 19 May 2026 08:46:33 +0000 (10:46 +0200)
If devm_request_threaded_irq() fails after drm_bridge_add(), remove the
bridge before returning.

Keep drm_bridge_add() rather than devm_drm_bridge_add(): registration is
tied to the STDP4028 device while ge_b850v3_register() may complete from
either I2C probe; devm would not unwind the bridge if the other client's
probe fails.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Fixes: fcfa0ddc18ed ("drm/bridge: Drivers for megachips-stdpxxxx-ge-b850v3-fw (LVDS-DP++)")
Cc: stable@vger.kernel.org
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Ian Ray <ian.ray@gehealthcare.com>
Link: https://patch.msgid.link/20260430195700.80317-1-osama.abdelkader@gmail.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c

index c9e6505cbd88214131a94a22ee17f62bc296d755..2d02cc69f23749219c97cc9509710f0af2b3ab82 100644 (file)
@@ -251,7 +251,6 @@ static void ge_b850v3_lvds_remove(void)
                goto out;
 
        drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge);
-
        ge_b850v3_lvds_ptr = NULL;
 out:
        mutex_unlock(&ge_b850v3_lvds_dev_mutex);
@@ -261,6 +260,7 @@ static int ge_b850v3_register(void)
 {
        struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;
        struct device *dev = &stdp4028_i2c->dev;
+       int ret;
 
        /* drm bridge initialization */
        ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT |
@@ -277,11 +277,15 @@ static int ge_b850v3_register(void)
        if (!stdp4028_i2c->irq)
                return 0;
 
-       return devm_request_threaded_irq(&stdp4028_i2c->dev,
-                       stdp4028_i2c->irq, NULL,
-                       ge_b850v3_lvds_irq_handler,
-                       IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                       "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr);
+       ret = devm_request_threaded_irq(&stdp4028_i2c->dev,
+                                       stdp4028_i2c->irq, NULL,
+                                       ge_b850v3_lvds_irq_handler,
+                                       IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                                       "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr);
+       if (ret)
+               drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge);
+
+       return ret;
 }
 
 static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c)