soc/intel/common/acpi/pep: Use correct size_t length modifier

Building an image for the Purism Mini v2 with `x86_64-linux-gnu-gcc-11`
fails with the format warning below as the size of size_t differs
between 32-bit and 64-bit.

        CC         ramstage/soc/intel/common/block/acpi/pep.o
    src/soc/intel/common/block/acpi/pep.c: In function 'read_pmc_lpm_requirements':
    src/soc/intel/common/block/acpi/pep.c:57:50: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
       57 |                                 printk(BIOS_ERR, "Failed to retrieve LPM substate registers"
          |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       58 |                                        "from LPM, substate %lu, reg %lu\n", i, j);
          |                                                                             ~
          |                                                                             |
          |                                                                             size_t {aka unsigned int}
    src/soc/intel/common/block/acpi/pep.c:58:62: note: format string is defined here
       58 |                                        "from LPM, substate %lu, reg %lu\n", i, j);
          |                                                            ~~^
          |                                                              |
          |                                                              long unsigned int
          |                                                            %u
    src/soc/intel/common/block/acpi/pep.c:57:50: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
       57 |                                 printk(BIOS_ERR, "Failed to retrieve LPM substate registers"
          |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       58 |                                        "from LPM, substate %lu, reg %lu\n", i, j);
          |                                                                                ~
          |                                                                                |
          |                                                                                size_t {aka unsigned int}
    src/soc/intel/common/block/acpi/pep.c:58:71: note: format string is defined here
       58 |                                        "from LPM, substate %lu, reg %lu\n", i, j);
          |                                                                     ~~^
          |                                                                       |
          |                                                                       long unsigned int
          |                                                                     %u

The variables `i` and `j` are of type size_t, so use the corresponding
length modifier `z`.

Fixes: 2eb100dd ("soc/intel/common/block/acpi: Add LPM requirements support to PEPD _DSM")
Change-Id: I27bce0a6c62b1c1ebbca732761de2f59b042a5d4
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59057
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Paul Menzel 2021-11-09 21:56:09 +01:00 committed by Felix Held
parent 0594bf87c1
commit 5ca0015dc5
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ static void read_pmc_lpm_requirements(const struct soc_pmc_lpm *lpm,
enum cb_err result = pmc_send_ipc_cmd(cmd_reg, &req, &res);
if (result != CB_SUCCESS) {
printk(BIOS_ERR, "Failed to retrieve LPM substate registers"
"from LPM, substate %lu, reg %lu\n", i, j);
"from LPM, substate %zu, reg %zu\n", i, j);
free(reg);
return;
}