[Intel-gfx] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*

Rodrigo Siqueira rodrigosiqueiramelo at gmail.com
Sat Jul 7 23:22:38 UTC 2018


This commit fixes the GCC warning:

warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
                ^
warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[1], 0x80,

This commit cast the ptr pointer, which is a void *, to uint32_t * in
the pointer arithmetic operation.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
---
 lib/igt_fb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..ca905038 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -410,9 +410,11 @@ static int create_bo_for_fb(int fd, int width, int height,
 
 			switch (format->drm_id) {
 			case DRM_FORMAT_NV12:
-				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
+				memset(((uint32_t *)ptr) + offsets[0],
+				       full_range ? 0x00 : 0x10,
 				       calculated_stride * height);
-				memset(ptr + offsets[1], 0x80,
+				memset(((uint32_t *)ptr) + offsets[1],
+				       0x80,
 				       calculated_stride * height/2);
 				break;
 			case DRM_FORMAT_YUYV:
-- 
2.18.0



More information about the Intel-gfx mailing list