diff mbox series

drm/amdgpu: use %pap format string for phys_addr_t

Message ID 20180108125440.4052836-1-arnd@arndb.de
State Accepted
Commit fb8baefc7b2d7b93ad96abacbe63fa99e3d213d6
Headers show
Series drm/amdgpu: use %pap format string for phys_addr_t | expand

Commit Message

Arnd Bergmann Jan. 8, 2018, 12:53 p.m. UTC
The newly added get_local_mem_info() function prints a phys_addr_t
using 0x%llx, which is wrong on most 32-bit systems, as shown by
this warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c: In function 'get_local_mem_info':
include/linux/kern_levels.h:5:18: error: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'resource_size_t {aka unsigned int}' [-Werror=format=]
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:31: note: format string is defined here
  pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",

Passing the address by reference to the special %pap format string will
produce the correct output and avoid the warning.

Fixes: 30f1c0421ec5 ("drm/amdgpu: Implement get_local_mem_info")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.0

Comments

Felix Kuehling Jan. 8, 2018, 7:16 p.m. UTC | #1
This commit is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

Thanks,
  Felix


On 2018-01-08 07:53 AM, Arnd Bergmann wrote:
> The newly added get_local_mem_info() function prints a phys_addr_t

> using 0x%llx, which is wrong on most 32-bit systems, as shown by

> this warning:

>

> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c: In function 'get_local_mem_info':

> include/linux/kern_levels.h:5:18: error: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'resource_size_t {aka unsigned int}' [-Werror=format=]

> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:31: note: format string is defined here

>   pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",

>

> Passing the address by reference to the special %pap format string will

> produce the correct output and avoid the warning.

>

> Fixes: 30f1c0421ec5 ("drm/amdgpu: Implement get_local_mem_info")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

> index 335e454e2ee1..1d605e1c1d66 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

> @@ -294,8 +294,8 @@ void get_local_mem_info(struct kgd_dev *kgd,

>  	}

>  	mem_info->vram_width = adev->mc.vram_width;

>  

> -	pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",

> -			adev->mc.aper_base, aper_limit,

> +	pr_debug("Address base: %pap limit %pap public 0x%llx private 0x%llx\n",

> +			&adev->mc.aper_base, &aper_limit,

>  			mem_info->local_mem_size_public,

>  			mem_info->local_mem_size_private);

>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 335e454e2ee1..1d605e1c1d66 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -294,8 +294,8 @@  void get_local_mem_info(struct kgd_dev *kgd,
 	}
 	mem_info->vram_width = adev->mc.vram_width;
 
-	pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
-			adev->mc.aper_base, aper_limit,
+	pr_debug("Address base: %pap limit %pap public 0x%llx private 0x%llx\n",
+			&adev->mc.aper_base, &aper_limit,
 			mem_info->local_mem_size_public,
 			mem_info->local_mem_size_private);