Skip to contentSkip to conversation

drm/tiny: fix printk format string for 32-bit

PATCH In review Arnd Bergmann 3 participants 3 messages Mar 4, 2025

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

PATCH 1/1 drm/tiny: fix printk format string for 32-bit

From: Arnd Bergmann <[email protected]>

A size_t must be printed with the %z modifier instead of %l:

In file included from include/linux/device.h:15,
from include/linux/usb.h:19,
from drivers/gpu/drm/tiny/appletbdrm.c:19:
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_send_request':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] drivers/gpu/drm/tiny/appletbdrm.c:170:17: note: in expansion of macro 'drm_err'

  170 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
      |                 ^~~~~~~
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_read_response':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
drivers/gpu/drm/tiny/appletbdrm.c:211:17: note: in expansion of macro 'drm_err'
  211 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
      |                 ^~~~~~~
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
---
 drivers/gpu/drm/tiny/appletbdrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/appletbdrm.c +2 -2
index f5d177e234e4..394c8f9bd41a 100644
@@ -167,7 +167,7 @@ static int appletbdrm_send_request(struct appletbdrm_device *adev,
 	}
 
 	if (actual_size != size) {
-		drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
+		drm_err(drm, "Actual size (%d) doesn't match expected size (%zu)\n",
 			actual_size, size);
 		return -EIO;
 	}
@@ -208,7 +208,7 @@ static int appletbdrm_read_response(struct appletbdrm_device *adev,
 	}
 
 	if (actual_size != size) {
-		drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
+		drm_err(drm, "Actual size (%d) doesn't match expected size (%zu)\n",
 			actual_size, size);
 		return -EBADMSG;
 	}
Signature · 1 line
2.39.5
#1 lore raw

Hi

Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

A size_t must be printed with the %z modifier instead of %l:

In file included from include/linux/device.h:15,
from include/linux/usb.h:19,
from drivers/gpu/drm/tiny/appletbdrm.c:19:
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_send_request':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] drivers/gpu/drm/tiny/appletbdrm.c:170:17: note: in expansion of macro 'drm_err'

 170 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
     |                 ^~~~~~~
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_read_response':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
drivers/gpu/drm/tiny/appletbdrm.c:211:17: note: in expansion of macro 'drm_err'
 211 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
     |                 ^~~~~~~
Quoted 3 lines
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")

—

Its the duplicate of:

https://lore.kernel.org/dri-devel/20250304-appletbdrm-fix-size_t-specifier-v1-1-94fe1d2c91f8@kernel.org/

as well as

https://lore.kernel.org/dri-devel/[email protected]/

#2 lore raw
Quoted 22 lines · Aditya Garg

Hi

Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

A size_t must be printed with the %z modifier instead of %l:

In file included from include/linux/device.h:15,
from include/linux/usb.h:19,
from drivers/gpu/drm/tiny/appletbdrm.c:19:
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_send_request':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] drivers/gpu/drm/tiny/appletbdrm.c:170:17: note: in expansion of macro 'drm_err'

 170 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
     |                 ^~~~~~~
drivers/gpu/drm/tiny/appletbdrm.c: In function 'appletbdrm_read_response':
include/drm/drm_print.h:589:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
drivers/gpu/drm/tiny/appletbdrm.c:211:17: note: in expansion of macro 'drm_err'
 211 |                 drm_err(drm, "Actual size (%d) doesn't match expected size (%lu)\n",
     |                 ^~~~~~~
Quoted 7 lines
Quoted 3 lines
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")

—

Its the duplicate of:

https://lore.kernel.org/dri-devel/20250304-appletbdrm-fix-size_t-specifier-v1-1-94fe1d2c91f8@kernel.org/

Pushed this one to drm-misc-next.

BR,
Jani.

Quoted 6 lines

as well as

https://lore.kernel.org/dri-devel/[email protected]/

Signature · 1 line
Jani Nikula, Intel