drm/amd/amdgpu: Fix debugfs wave reader
authorTom St Denis <tom.stdenis@amd.com>
Thu, 13 Oct 2016 16:15:03 +0000 (12:15 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Oct 2016 18:38:46 +0000 (14:38 -0400)
On non VI/CZ platforms it would not free
the grbm index lock.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 62c360435732cd1e0137284decbcf3dfe975ee9d..188b8e0d7bca13e2c46b11988e1651610d784112 100644 (file)
@@ -2958,13 +2958,14 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf,
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x14);
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1A);
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1B);
-       } else {
-               return -EINVAL;
        }
 
        amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
        mutex_unlock(&adev->grbm_idx_mutex);
 
+       if (!x)
+               return -EINVAL;
+
        while (size && (*pos < x * 4)) {
                uint32_t value;