amdgpu/dce11: Add test for crtc < 0 to various DCEv11 functions
authorTom St Denis <tom.stdenis@amd.com>
Tue, 15 Dec 2015 18:03:43 +0000 (13:03 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Jan 2016 22:21:14 +0000 (17:21 -0500)
To be consistent with other DCE11 functions test for crtc < 0.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c

index 80be62a0b99bf8b45378ea10cedc95a15d662c44..8e67249d4367d1aff0737c8ea3b48369b8019bc4 100644 (file)
@@ -213,7 +213,7 @@ static void dce_v11_0_vblank_wait(struct amdgpu_device *adev, int crtc)
 {
        unsigned i = 100;
 
-       if (crtc >= adev->mode_info.num_crtc)
+       if (crtc < 0 || crtc >= adev->mode_info.num_crtc)
                return;
 
        if (!(RREG32(mmCRTC_CONTROL + crtc_offsets[crtc]) & CRTC_CONTROL__CRTC_MASTER_EN_MASK))
@@ -241,7 +241,7 @@ static void dce_v11_0_vblank_wait(struct amdgpu_device *adev, int crtc)
 
 static u32 dce_v11_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
 {
-       if (crtc >= adev->mode_info.num_crtc)
+       if (crtc < 0 || crtc >= adev->mode_info.num_crtc)
                return 0;
        else
                return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
@@ -3386,7 +3386,7 @@ static void dce_v11_0_crtc_vblank_int_ack(struct amdgpu_device *adev,
 {
        u32 tmp;
 
-       if (crtc >= adev->mode_info.num_crtc) {
+       if (crtc < 0 || crtc >= adev->mode_info.num_crtc) {
                DRM_DEBUG("invalid crtc %d\n", crtc);
                return;
        }
@@ -3401,7 +3401,7 @@ static void dce_v11_0_crtc_vline_int_ack(struct amdgpu_device *adev,
 {
        u32 tmp;
 
-       if (crtc >= adev->mode_info.num_crtc) {
+       if (crtc < 0 || crtc >= adev->mode_info.num_crtc) {
                DRM_DEBUG("invalid crtc %d\n", crtc);
                return;
        }