[PATCH] drm/amd/amdgpu: Fix amdgpu_debugfs_gpr_read()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The callback functions always write to the start of
the array.  The 'offset' parameter instructs
the callbacks the offset into the registers to start
reading from.  So we always copy from the temporary buffer
starting at offset 0.

Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 48e892e57368..544d18a1fefb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3800,7 +3800,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
 	struct amdgpu_device *adev = f->f_inode->i_private;
 	int r;
 	ssize_t result = 0;
-	uint32_t offset, se, sh, cu, wave, simd, thread, bank, *data;
+	uint32_t x, offset, se, sh, cu, wave, simd, thread, bank, *data;
 
 	if (size & 3 || *pos & 3)
 		return -EINVAL;
@@ -3834,10 +3834,11 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
 	amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
 	mutex_unlock(&adev->grbm_idx_mutex);
 
+	x = 0;
 	while (size) {
 		uint32_t value;
 
-		value = data[offset++];
+		value = data[x++];
 		r = put_user(value, (uint32_t *)buf);
 		if (r) {
 			result = r;
-- 
2.12.0



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux