/* none -> real source transition */
        if (source) {
+               pipe_crc->entries = kzalloc(sizeof(*pipe_crc->entries) *
+                                           INTEL_PIPE_CRC_ENTRIES_NR,
+                                           GFP_KERNEL);
+               if (!pipe_crc->entries)
+                       return -ENOMEM;
+
                atomic_set(&pipe_crc->head, 0);
                atomic_set(&pipe_crc->tail, 0);
        }
        I915_WRITE(PIPE_CRC_CTL(pipe), val);
        POSTING_READ(PIPE_CRC_CTL(pipe));
 
+       /* real source -> none transition */
+       if (source == INTEL_PIPE_CRC_SOURCE_NONE) {
+               kfree(pipe_crc->entries);
+               pipe_crc->entries = NULL;
+       }
+
        return 0;
 }
 
 
 
 #define INTEL_PIPE_CRC_ENTRIES_NR      128
 struct intel_pipe_crc {
-       struct intel_pipe_crc_entry entries[INTEL_PIPE_CRC_ENTRIES_NR];
+       struct intel_pipe_crc_entry *entries;
        enum intel_pipe_crc_source source;
        atomic_t head, tail;
 };