Skip to contentSkip to conversation

drm/amdgpu: fix printk format for size_t variable

PATCH In review [email protected] 2 participants 5 messages Feb 21, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix printk format for size_t variable

From: Tom Rix <[email protected]>

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")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index 7c7e28fd912e..58238f67b1d3 100644
@@ -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.
Signature · 1 line
2.26.3
Acked-by Alex Deucher on v1 1/1
#1 lore raw

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 <[email protected]>
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 <[email protected]>
Fixes 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index 2506bcf36c870c..6c7ec058125e1d 100644
@@ -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

Quoted 21 lines · On 2022-02-21 12:37, [email protected] wrote:

From: Tom Rix <[email protected]>

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")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
index 7c7e28fd912e..58238f67b1d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, · line 674

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -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,

Signature · 1 line
Luben
author
#2 lore raw
Quoted 11 lines · Luben Tuikov

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 <[email protected]>
Date:   Wed Feb 16 16:47:32 2022 -0500

drm/amdgpu: Fix ARM compilation warning

Fix this ARM warning:

I glad it wasn't just mips ;)

There have been a couple of build breaks with amdgpu recently.

Nick asked about adding clang to your ci.

Could at least one non x86_64 gcc also be added, maybe aarch64 ?

Tom

Quoted 61 lines

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 <[email protected]>
Fixes 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index 2506bcf36c870c..6c7ec058125e1d 100644
@@ -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

Quoted 21 lines · On 2022-02-21 12:37, [email protected] wrote:

From: Tom Rix <[email protected]>

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")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
index 7c7e28fd912e..58238f67b1d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, · line 674

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -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,

#3 lore raw
Quoted 14 lines · Tom Rix
Quoted 11 lines · Luben Tuikov

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 <[email protected]>
Date:   Wed Feb 16 16:47:32 2022 -0500

drm/amdgpu: Fix ARM compilation warning

Fix this ARM warning:

Quoted 7 lines

I glad it wasn't just mips ;)

There have been a couple of build breaks with amdgpu recently.

Nick asked about adding clang to your ci.

Could at least one non x86_64 gcc also be added, maybe aarch64 ?

Yeah, that's a great idea. I tried the make.cross (for ARM) as per
the initial breakage report, but when I tried it, it got into a loop of
"make ARCH=arm mrproper" --> "make prepare" --> "make ARCH=arm mrproper" --> "make prepare" --> ... and I couldn't figure out why.

I don't mind adding ARM cross compilation into my local setup.

Regards,
Luben

Quoted 65 lines

Tom

Quoted 61 lines

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 <[email protected]>
Fixes 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index 2506bcf36c870c..6c7ec058125e1d 100644
@@ -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

Quoted 21 lines · On 2022-02-21 12:37, [email protected] wrote:

From: Tom Rix <[email protected]>

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")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
index 7c7e28fd912e..58238f67b1d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, · line 674

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -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,

Regards,

Signature · 1 line
Luben
author
#4 lore raw
Quoted 17 lines · Luben Tuikov
Quoted 16 lines · Tom Rix
Quoted 11 lines · Luben Tuikov

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 <[email protected]>
Date:   Wed Feb 16 16:47:32 2022 -0500

drm/amdgpu: Fix ARM compilation warning

Fix this ARM warning:

I glad it wasn't just mips ;)

There have been a couple of build breaks with amdgpu recently.

Quoted 7 lines
Quoted 3 lines

Nick asked about adding clang to your ci.

Could at least one non x86_64 gcc also be added, maybe aarch64 ?

Yeah, that's a great idea. I tried the make.cross (for ARM) as per
the initial breakage report, but when I tried it, it got into a loop of
"make ARCH=arm mrproper" --> "make prepare" --> "make ARCH=arm mrproper" --> "make prepare" --> ... and I couldn't figure out why.

Maybe need to set CROSS_COMPILE ?

Quoted 1 line

I don't mind adding ARM cross compilation into my local setup.

For crosses, I generate a 'make' script like

#!/bin/sh

export PATH=<path-to-cross-tools>/bin:$PATH

make ARCH=arm64 CROSS_COMPILE=aarch64-elf- $@

so workflow looks like normal, replacing make with ./make

Tom

Quoted 69 lines

Regards,
Luben

Quoted 63 lines

Tom

Quoted 61 lines

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 <[email protected]>
Fixes 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index 2506bcf36c870c..6c7ec058125e1d 100644
@@ -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

Quoted 21 lines · On 2022-02-21 12:37, [email protected] wrote:

From: Tom Rix <[email protected]>

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")
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
index 7c7e28fd912e..58238f67b1d3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, · line 674

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -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,

Regards,