[PATCH] drm: adv7511: Fix crash in IRQ handler when no encoder is associated

2015-05-14 Thread Laurent Pinchart
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 
---
 drivers/gpu/drm/i2c/adv7511.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index b728523e194f..2aaa3c88999e 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -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) {
-- 
Regards,

Laurent Pinchart



[PATCH] drm: adv7511: Fix crash in IRQ handler when no encoder is associated

2015-05-14 Thread Lars-Peter Clausen
On 05/14/2015 02:29 PM, Laurent Pinchart wrote:
> 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 

Acked-by: Lars-Peter Clausen 

> ---
>   drivers/gpu/drm/i2c/adv7511.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
> index b728523e194f..2aaa3c88999e 100644
> --- a/drivers/gpu/drm/i2c/adv7511.c
> +++ b/drivers/gpu/drm/i2c/adv7511.c
> @@ -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) {
>