Skip to content
  • Geert Uytterhoeven's avatar
    amdgpu: Fix pointer/integer mismatch warning · ca041d5f
    Geert Uytterhoeven authored and Geert Uytterhoeven's avatar Geert Uytterhoeven committed
    
    
    On 32-bit:
    
        ../amdgpu/amdgpu_bo.c: In function ‘amdgpu_find_bo_by_cpu_mapping’:
        ../amdgpu/amdgpu_bo.c:554:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
               cpu < (void*)((uintptr_t)bo->cpu_ptr + bo->alloc_size))
                     ^
    
    Indeed, as amdgpu_bo_info.alloc_size is "uint64_t", the sum is
    always 64-bit, while "void *" can be 32-bit or 64-bit.
    
    Fix this by casting bo->alloc_size to "size_t", which is either
    32-bit or 64-bit, just like "void *".
    
    Fixes: c6493f36 ("amdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping")
    Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
    ---
    v2:
      - Add Reviewed-by.
    ca041d5f
Loading