drm: adv7511: Fix crash in IRQ handler when no encoder is associated
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 13 May 2015 21:31:07 +0000 (00:31 +0300)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 25 May 2015 12:34:00 +0000 (15:34 +0300)
The ADV7511 is probed before its slave encoder init function associates
it with an encoder. This creates a time window during which hot plug
detection interrupts can occur with an encoder, resulting in a crash in
the IRQ handler.

Fix this by ignoring hot plug detection IRQs when no encoder is
associated yet.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
drivers/gpu/drm/i2c/adv7511.c

index b728523e194f7581b8e9740b7ddb13e6f5606d56..2aaa3c88999e32c0f951312b48aedded13f837e0 100644 (file)
@@ -438,7 +438,7 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
        regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
        regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
 
-       if (irq0 & ADV7511_INT0_HDP)
+       if (irq0 & ADV7511_INT0_HDP && adv7511->encoder)
                drm_helper_hpd_irq_event(adv7511->encoder->dev);
 
        if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {