Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85251?usp=email )
Change subject: soc/amd/common/psp/rpmc: fix printk format string ......................................................................
soc/amd/common/psp/rpmc: fix printk format string
While gcc didn't seem to care about that mismatch, clang didn't like that '%ld' was used in the printk format string to print a size_t variable. Since we're dealing with small numbers here, use an unsigned int as counter in the for loop and change that part of the format string to '%d'. The other option would have been to keep using size_t for the for loop counter, but using '%zu' for this in the format sting just seemed odd to me.
Change-Id: I32bc584abe835c9c1d732c12311881345b8f0cdf Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/common/block/psp/rpmc.c 1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/85251/1
diff --git a/src/soc/amd/common/block/psp/rpmc.c b/src/soc/amd/common/block/psp/rpmc.c index dd097c5..b4e853b 100644 --- a/src/soc/amd/common/block/psp/rpmc.c +++ b/src/soc/amd/common/block/psp/rpmc.c @@ -77,13 +77,13 @@
static void print_spi_rpmc_usage(uint8_t available, uint8_t used) { - for (size_t i = 0; i < SPI_RPMC_COUNTER_COUNT; i++) { - printk(BIOS_SPEW, "SPI flash RPMC counter %ld %s provisioned\n", i, + for (unsigned int i = 0; i < SPI_RPMC_COUNTER_COUNT; i++) { + printk(BIOS_SPEW, "SPI flash RPMC counter %d %s provisioned\n", i, available & BIT(i) ? "can still be" : "has already been"); }
- for (size_t i = 0; i < SPI_RPMC_COUNTER_COUNT; i++) { - printk(BIOS_SPEW, "SPI flash RPMC counter %ld is%s in use\n", i, + for (unsigned int i = 0; i < SPI_RPMC_COUNTER_COUNT; i++) { + printk(BIOS_SPEW, "SPI flash RPMC counter %d is%s in use\n", i, used & BIT(i) ? "" : " not"); } } @@ -96,8 +96,8 @@ psp_caps.r0.psp_nvram_rpmc_protected); print_spi_rpmc_usage(psp_caps.r0.spi_rpmc_slots_available, psp_caps.r0.spi_rpmc_slot_used); - for (size_t i = 0; i < PSP_RPMC_R0_SLOT_COUNT; i++) { - printk(BIOS_SPEW, "SoC RPMC slot %ld %s provisioned\n", i, + for (unsigned int i = 0; i < PSP_RPMC_R0_SLOT_COUNT; i++) { + printk(BIOS_SPEW, "SoC RPMC slot %d %s provisioned\n", i, psp_caps.r0.psp_rpmc_slot_available & BIT(i) ? "can still be" : "has already been"); }