amdgpu: Fix pointer/integer mismatch warning
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 5 Jul 2023 13:23:24 +0000 (15:23 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 4 Sep 2023 07:31:36 +0000 (09:31 +0200)
commitca041d5fe66bd22542dbfd93e991d5aa20950d76
treeaca87f2712984b841b5f5ad2237c5ba361852dbf
parent7bdb135f0c8e6ae2c0ed6d4bd6a8423eb1df5c26
amdgpu: Fix pointer/integer mismatch warning

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: c6493f360e7529c2 ("amdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
---
v2:
  - Add Reviewed-by.
amdgpu/amdgpu_bo.c