Re: [PATCH 1/2] powerpc64/bpf: Fix build break in bpf_jit_emit_func_call_rel()

Madhavan Srinivasan <[email protected]> Thu, 30 Jul 2026 08:06:05 +0530
Newsgroups org.ozlabs.lists.linuxppc-dev,org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 7/29/26 10:15 PM, Christophe Leroy (CS GROUP) wrote:
>
>
> Le 29/07/2026 à 18:03, Saket Kumar Bhaskar a écrit :
>> From: Madhavan Srinivasan <[email protected]>
>>
>> With CONFIG_PPC_KERNEL_PCREL enabled, build breaks with below error:
>>
>>    CC      mm/dmapool.o
>>    CC      fs/readdir.o
>> arch/powerpc/net/bpf_jit_comp64.c: In function 
>> 'bpf_jit_emit_func_call_rel':
>> arch/powerpc/net/bpf_jit_comp64.c:475:13: error: unused variable 
>> 'ret' [-Werror=unused-variable]
>>    475 |         int ret;
>>        |             ^~~
>>
>> commit b55b6b9ad76c ("powerpc64/bpf: Add powerpc64 JIT support for 
>> timed may_goto")
>> introduced "ret" variable to bpf_jit_emit_func_call_rel() and it is 
>> used only in
>> else block of CONFIG_PPC_KERNEL_PCREL, fix by adding a "__maybe_unused"
>
> __maybe_unused doesn't fix the problem, it just hides it under the 
> carpet.
>
My bad, took the precedence from reladdr, may be it is better to change 
that too then

Maddy
> ret is used at only one place, move it's declaration their:
>
> #else
>     if (core_kernel_text(func_addr)) {
>         int ret = bpf_jit_emit_func_call(image, ctx, func_addr, _R12);
>         if (ret)
>             return ret;
>     } else {
>
>>
>> Fixes: b55b6b9ad76c ("powerpc64/bpf: Add powerpc64 JIT support for 
>> timed may_goto")
>> Signed-off-by: Madhavan Srinivasan <[email protected]>
>> Signed-off-by: Saket Kumar Bhaskar <[email protected]>
>> ---
>>   arch/powerpc/net/bpf_jit_comp64.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/net/bpf_jit_comp64.c 
>> b/arch/powerpc/net/bpf_jit_comp64.c
>> index dab106cae22b..63952ef19256 100644
>> --- a/arch/powerpc/net/bpf_jit_comp64.c
>> +++ b/arch/powerpc/net/bpf_jit_comp64.c
>> @@ -472,7 +472,7 @@ int bpf_jit_emit_func_call_rel(u32 *image, u32 
>> *fimage, struct codegen_context *
>>   {
>>       unsigned long func_addr = func ? ppc_function_entry((void 
>> *)func) : 0;
>>       long __maybe_unused reladdr;
>> -    int ret;
>> +    int __maybe_unused ret;
>>         /* bpf to bpf call, func is not known in the initial pass. 
>> Emit 5 nops as a placeholder */
>>       if (!func) {
>