drm: bridge: analogix/dp: Fix the possible dead lock in bridge disable time

Yakir Yang ykk at rock-chips.com
Thu Apr 7 03:07:55 UTC 2016


Hi Dan,

On 04/07/2016 03:41 AM, Dan Carpenter wrote:
> Hello Yakir Yang,
>
> The patch 7b4b7a8db439: "drm: bridge: analogix/dp: Fix the possible
> dead lock in bridge disable time" from Feb 15, 2016, leads to the
> following static checker warning:
>
> 	drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:875 analogix_dp_irq_thread()
> 	warn: bitwise AND condition is false here
>
> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>     869  static irqreturn_t analogix_dp_irq_thread(int irq, void *arg)
>     870  {
>     871          struct analogix_dp_device *dp = arg;
>     872          enum dp_irq_type irq_type;
>     873
>     874          irq_type = analogix_dp_get_irq_type(dp);
>     875          if (irq_type & DP_IRQ_TYPE_HP_CABLE_IN ||
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This is never true.  Maybe test_bit() for these?
Ah, yep, it's an error here. The enum value of DP_IRQ_TYPE_HP_CABLE_IN
is zero, so even if analogix_dp_get_irq_type return the CABLE_IN event, 
driver
could not send the drm hpd event rightly.

Good catch, would need to assign the new enum value, like

  enum dp_irq_type {
-       DP_IRQ_TYPE_HP_CABLE_IN,
-       DP_IRQ_TYPE_HP_CABLE_OUT,
-       DP_IRQ_TYPE_HP_CHANGE,
-       DP_IRQ_TYPE_UNKNOWN,
+       DP_IRQ_TYPE_HP_CABLE_IN  = BIT(0),
+       DP_IRQ_TYPE_HP_CABLE_OUT = BIT(1),
+       DP_IRQ_TYPE_HP_CHANGE    = BIT(2),
+       DP_IRQ_TYPE_UNKNOWN      = BIT(3),
  };


Thanks for pointing out, would send patch to fix that soon.

- Yakir
>
>     876              irq_type & DP_IRQ_TYPE_HP_CABLE_OUT) {
>     877                  dev_dbg(dp->dev, "Detected cable status changed!\n");
>     878                  if (dp->drm_dev)
>     879                          drm_helper_hpd_irq_event(dp->drm_dev);
>     880          }
>     881
>     882          if (irq_type != DP_IRQ_TYPE_UNKNOWN) {
>     883                  analogix_dp_clear_hotplug_interrupts(dp);
>     884                  analogix_dp_unmute_hpd_interrupt(dp);
>     885          }
>     886
>     887          return IRQ_HANDLED;
>     888  }
>
> regards,
> dan carpenter
>
>
>




More information about the dri-devel mailing list