drm/i915: Reject opening of pipe crc files for invalid pipes
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 14 Nov 2013 10:30:43 +0000 (11:30 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 14 Nov 2013 11:24:04 +0000 (12:24 +0100)
We don't init the lock nor set up all the other state. And it doesn't
make sense anyway.

This appeases lockdep when running the igt/drv_debugfs_reader test.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_debugfs.c

index 8362dc154af4c2eff6b02a7b6384f220f87d913a..506f8efeb519c2def42db6fd181aaff96d068870 100644 (file)
@@ -1771,6 +1771,9 @@ static int i915_pipe_crc_open(struct inode *inode, struct file *filep)
        struct drm_i915_private *dev_priv = info->dev->dev_private;
        struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[info->pipe];
 
+       if (info->pipe >= INTEL_INFO(info->dev)->num_pipes)
+               return -ENODEV;
+
        spin_lock_irq(&pipe_crc->lock);
 
        if (pipe_crc->opened) {