drm/i915: Check num_pipes before initializing audio component
authorElaine Wang <[email protected]>
Mon, 19 Dec 2016 10:19:05 +0000 (18:19 +0800)
committerJani Nikula <[email protected]>
Thu, 22 Dec 2016 10:29:17 +0000 (12:29 +0200)
when num_pipes is zero, it indicates there is no display and HDMI
audio doesn't exist.

v2: Move the check from caller to callee for consistency.

Cc: Chris Wilson <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Jani Nikula <[email protected]>
Signed-off-by: Elaine Wang <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/i915/intel_audio.c

index 3bbc96c1767f2da807bea74cb9aef43b4efdb999..16c202781db08c677514adc9eb0e490f0239457b 100644 (file)
@@ -928,6 +928,9 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv)
 {
        int ret;
 
+       if (INTEL_INFO(dev_priv)->num_pipes == 0)
+               return;
+
        ret = component_add(dev_priv->drm.dev, &i915_audio_component_bind_ops);
        if (ret < 0) {
                DRM_ERROR("failed to add audio component (%d)\n", ret);