drm/i915: Set crtc backpointer when duplicating crtc state
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Tue, 3 Mar 2015 13:21:55 +0000 (15:21 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 17 Mar 2015 21:29:53 +0000 (22:29 +0100)
In the path were there is no state to duplicate, the allocated crtc
state wouldn't have the crtc backpointer initialized.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_atomic.c

index 011b8960fd75baab5fda39d768257625345bde7a..3903b90fb64efa80e1906d3ef1c6b4ad75866092 100644 (file)
@@ -214,12 +214,18 @@ struct drm_crtc_state *
 intel_crtc_duplicate_state(struct drm_crtc *crtc)
 {
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       struct intel_crtc_state *crtc_state;
 
        if (WARN_ON(!intel_crtc->config))
-               return kzalloc(sizeof(*intel_crtc->config), GFP_KERNEL);
+               crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
+       else
+               crtc_state = kmemdup(intel_crtc->config,
+                                    sizeof(*intel_crtc->config), GFP_KERNEL);
 
-       return kmemdup(intel_crtc->config, sizeof(*intel_crtc->config),
-                      GFP_KERNEL);
+       if (crtc_state)
+               crtc_state->base.crtc = crtc;
+
+       return &crtc_state->base;
 }
 
 /**