aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni.dodonov@intel.com>2012-05-09 14:37:12 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-19 16:39:44 -0400
commit5826eca5ac58469a704984bceaebfda5bcb383db (patch)
tree01596043830eec5a913b73c818aef31ce0b5f6db /drivers/gpu
parent461bc9b587389586edf9315b337fb136f33594ad (diff)
drm/i915: properly check for pipe count
As suggested by Chris Wilson and Daniel Vetter, this chunk of code can be simplified with a more simple check. Also, as noticed by Jesse Barnes, it is worth mentioning that plane is an enum and num_pipe is an int, so we could be more paranoid here about those validation checks eventually. CC: Daniel Vetter <daniel.vetter@ffwll.ch> CC: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 45b93a096191..6b93d4a697ed 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1980,16 +1980,10 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1980 return 0; 1980 return 0;
1981 } 1981 }
1982 1982
1983 switch (intel_crtc->plane) { 1983 if(intel_crtc->plane > dev_priv->num_pipe) {
1984 case 0: 1984 DRM_ERROR("no plane for crtc: plane %d, num_pipes %d\n",
1985 case 1: 1985 intel_crtc->plane,
1986 break; 1986 dev_priv->num_pipe);
1987 case 2:
1988 if (IS_IVYBRIDGE(dev))
1989 break;
1990 /* fall through otherwise */
1991 default:
1992 DRM_ERROR("no plane for crtc\n");
1993 return -EINVAL; 1987 return -EINVAL;
1994 } 1988 }
1995 1989