Skip to content
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

Merged

Conversation

mateusz-holenko
Copy link
Collaborator

The previous version generated compilation warnings.

Discovered in #78483.

@zephyrbot zephyrbot added area: LED Label to identify LED subsystem size: XS A PR changing only a single line of code labels Sep 24, 2024
@@ -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);
Copy link
Collaborator

@simonguinot simonguinot Sep 24, 2024

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).

Copy link
Collaborator Author

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]>
Copy link
Collaborator

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@carlescufi carlescufi merged commit aa7c367 into zephyrproject-rtos:main Oct 7, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LED Label to identify LED subsystem size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants