-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: led_strip: Fix formatting of log message #78937
drivers: led_strip: Fix formatting of log message #78937
Conversation
drivers/led_strip/lpd880x.c
Outdated
@@ -78,7 +78,7 @@ static int lpd880x_update(const struct device *dev, void *data, size_t size) | |||
|
|||
rc = spi_write_dt(&config->bus, &tx); | |||
if (rc) { | |||
LOG_ERR("can't update strip: %d", rc); | |||
LOG_ERR("can't update strip: %lu", rc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mateusz-holenko,
Thanks for this patch. Are you compiling for a 64-bit target ?
size_t
is unsigned int
on 32-bit platforms but long unsigned int
on 64-bit. So I suggest we use %zu
here. It is the length specifier dedicated to size_t
(C99).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @simonguinot, thanks for the suggestion. It's fixed now.
For the record I based my previous solution on an error observed in Zephyr CI (https://github.com/zephyrproject-rtos/zephyr/actions/runs/10997274239/job/30536320469#step:12:332) which claimed:
/__w/zephyr/zephyr/drivers/led_strip/lpd880x.c:81:25: error: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
It was targetting intel_adl_crb
(alder_lake
) so yes, a 64-bit target.
The previous version generated compilation warnings. Signed-off-by: Mateusz Hołenko <[email protected]>
0804916
to
08000fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
The previous version generated compilation warnings.
Discovered in #78483.