OSDN Git Service

amdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping
authorMichel Dänzer <michel.daenzer@amd.com>
Tue, 14 Aug 2018 09:53:19 +0000 (11:53 +0200)
committerMichel Dänzer <michel@daenzer.net>
Fri, 17 Aug 2018 07:12:42 +0000 (09:12 +0200)
commitc6493f360e7529c26042b7a5c63725c82de88d8a
tree74522aaeb41816e12c3a81fc0272417e0cef9acb
parentcc472c5bb30262defe07d9fb1ef0fe6a020b2ea9
amdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping

Arithmetic using void* pointers isn't defined by the C standard, only as
a GCC extension. Avoids compiler warnings:

../../amdgpu/amdgpu_bo.c: In function ‘amdgpu_find_bo_by_cpu_mapping’:
../../amdgpu/amdgpu_bo.c:554:48: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
   if (cpu >= bo->cpu_ptr && cpu < (bo->cpu_ptr + bo->alloc_size))
                                                ^
../../amdgpu/amdgpu_bo.c:561:23: warning: pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
   *offset_in_bo = cpu - bo->cpu_ptr;
                       ^

v2: Use uintptr_t instead of char*, don't change function signature
    (Junwei Zhang)

Fixes: 4d454424e1f2 ("amdgpu: add a function to find bo by cpu mapping
                     (v2)")
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
amdgpu/amdgpu_bo.c