Commit d45d5c81 authored by Osama Abdelkader's avatar Osama Abdelkader Committed by Luca Ceresoli
Browse files

drm/bridge: megachips: remove bridge when irq request fails



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: default avatarOsama Abdelkader <osama.abdelkader@gmail.com>
Fixes: fcfa0ddc ("drm/bridge: Drivers for megachips-stdpxxxx-ge-b850v3-fw (LVDS-DP++)")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: default avatarIan Ray <ian.ray@gehealthcare.com>
Link: https://patch.msgid.link/20260430195700.80317-1-osama.abdelkader@gmail.com


Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
parent 73d01051
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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,
	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)