Skip to content

Commit d45d5c8

Browse files
osamakaderlucaceresoli
authored andcommitted
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: Osama Abdelkader <osama.abdelkader@gmail.com> Fixes: fcfa0dd ("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>
1 parent 73d0105 commit d45d5c8

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ static void ge_b850v3_lvds_remove(void)
251251
goto out;
252252

253253
drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge);
254-
255254
ge_b850v3_lvds_ptr = NULL;
256255
out:
257256
mutex_unlock(&ge_b850v3_lvds_dev_mutex);
@@ -261,6 +260,7 @@ static int ge_b850v3_register(void)
261260
{
262261
struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;
263262
struct device *dev = &stdp4028_i2c->dev;
263+
int ret;
264264

265265
/* drm bridge initialization */
266266
ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT |
@@ -277,11 +277,15 @@ static int ge_b850v3_register(void)
277277
if (!stdp4028_i2c->irq)
278278
return 0;
279279

280-
return devm_request_threaded_irq(&stdp4028_i2c->dev,
281-
stdp4028_i2c->irq, NULL,
282-
ge_b850v3_lvds_irq_handler,
283-
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
284-
"ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr);
280+
ret = devm_request_threaded_irq(&stdp4028_i2c->dev,
281+
stdp4028_i2c->irq, NULL,
282+
ge_b850v3_lvds_irq_handler,
283+
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
284+
"ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr);
285+
if (ret)
286+
drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge);
287+
288+
return ret;
285289
}
286290

287291
static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c)

0 commit comments

Comments
 (0)