[Intel-gfx] [PATCH 2/2] drm/i915: Fix the return value of pipe crc read function.

Rodrigo Vivi rodrigo.vivi at intel.com
Wed Aug 3 04:42:07 UTC 2016


A read(fd, buf, len) function should return the number
of bytes read. In our case we need to return the
number of bytes we copy to user, instead of returning
the number of bytes we read internally.

It was really strange when I saw i-g-t test case using
len '54' but getting '56' as return. First thought was
how do we read more than we asked? But also I checked
and there was really only 54. Until I realized it
was all our fault. EFAULT!

Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 7052c47..b7b8d79 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3659,7 +3659,7 @@ i915_pipe_crc_read(struct file *filep, char __user *user_buf, size_t count,
 
 	spin_unlock_irq(&pipe_crc->lock);
 
-	return bytes_read;
+	return PIPE_CRC_LINE_LEN;
 }
 
 static const struct file_operations i915_pipe_crc_fops = {
-- 
2.5.5



More information about the Intel-gfx mailing list