Re: [PATCH] drm/amdgpu: fix printk format for size_t variable

From: Luben Tuikov
Date: Mon Feb 21 2022 - 14:57:34 EST


Hi Tom,

This was already fixed with this patch, and LKML was CC-ed. See the CC tags in the patch below,

commit 4f7d7cda90cbd7
Author: Luben Tuikov <luben.tuikov@xxxxxxx>
Date: Wed Feb 16 16:47:32 2022 -0500

drm/amdgpu: Fix ARM compilation warning

Fix this ARM warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:664:35: warning: format '%ld'
expects argument of type 'long int', but argument 4 has type 'size_t' {aka
'unsigned int'} [-Wformat=]

Cc: Alex Deucher <Alexander.Deucher@xxxxxxx>
Cc: kbuild-all@xxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Fixes: 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
Signed-off-by: Luben Tuikov <luben.tuikov@xxxxxxx>
Acked-by: Alex Deucher <Alexander.Deucher@xxxxxxx>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 2506bcf36c870c..6c7ec058125e1d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
le16_to_cpu(ip->hw_id) != ii)
goto next_ip;

- DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
+ DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);

/* We have a hw_id match; register the hw
* block if not yet registered.

Regards,
Luben

On 2022-02-21 12:37, trix@xxxxxxxxxx wrote:
> From: Tom Rix <trix@xxxxxxxxxx>
>
> On mips64 allyesconfig, there is this build break
> amdgpu_discovery.c:671:35: error: format '%ld' expects
> argument of type 'long int', but argument 4 has
> type 'size_t' {aka 'unsigned int'}
> DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>
> For size_t, use %zu.
>
> Fixes: a6c40b178092 ("drm/amdgpu: Show IP discovery in sysfs")
> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 7c7e28fd912e..58238f67b1d3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
> le16_to_cpu(ip->hw_id) != ii)
> goto next_ip;
>
> - DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
> + DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
>
> /* We have a hw_id match; register the hw
> * block if not yet registered.

Regards,
--
Luben