[PATCH v2 1/2] lib: utils/fdt_cppc_rpmi: Fix compile error with LLVM
Anup Patel
anup at brainfault.org
Sat Dec 14 22:03:13 PST 2024
On Tue, Dec 10, 2024 at 10:53 AM Anup Patel <apatel at ventanamicro.com> wrote:
>
> The following error is observed when compiling fdt_cppc_rpmi
> driver using LLVM:
>
> lib/utils/cppc/fdt_cppc_rpmi.c:87:3: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]
> 87 | u64 db_val_u64 = 0;
>
> To fix the above issue, move the variable declaration at the
> start of function.
>
> Fixes: 591a98bdd549 ("lib: utils/cppc: Add RPMI CPPC driver")
> Signed-off-by: Anup Patel <apatel at ventanamicro.com>
Applied this patch to the riscv/opensbi repo.
Regards,
Anup
> ---
> lib/utils/cppc/fdt_cppc_rpmi.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/utils/cppc/fdt_cppc_rpmi.c b/lib/utils/cppc/fdt_cppc_rpmi.c
> index 26e2d4f6..b6789901 100644
> --- a/lib/utils/cppc/fdt_cppc_rpmi.c
> +++ b/lib/utils/cppc/fdt_cppc_rpmi.c
> @@ -59,6 +59,11 @@ static void rpmi_cppc_fc_db_trigger(struct rpmi_cppc *cppc)
> u8 db_val_u8 = 0;
> u16 db_val_u16 = 0;
> u32 db_val_u32 = 0;
> +#if __riscv_xlen != 32
> + u64 db_val_u64 = 0;
> +#else
> + u32 db_val_u32_hi = 0;
> +#endif
>
> switch (cppc->fc_db_width) {
> case RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_8:
> @@ -84,14 +89,12 @@ static void rpmi_cppc_fc_db_trigger(struct rpmi_cppc *cppc)
> break;
> case RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_64:
> #if __riscv_xlen != 32
> - u64 db_val_u64 = 0;
> db_val_u64 = readq((void *)cppc->fc_db_addr);
> db_val_u64 = cppc->fc_db_setmask |
> (db_val_u64 & cppc->fc_db_preservemask);
>
> writeq(db_val_u64, (void *)cppc->fc_db_addr);
> #else
> - u32 db_val_u32_hi = 0;
> db_val_u32 = readl((void *)cppc->fc_db_addr);
> db_val_u32_hi = readl((void *)(cppc->fc_db_addr + 4));
>
> --
> 2.43.0
>
More information about the opensbi
mailing list