Skip to content

Commit e30329b

Browse files
luisgerhorstAlexei Starovoitov
authored andcommitted
powerpc/bpf: Fix warning for unused ori31_emitted
Without this, the compiler (clang21) might emit a warning under W=1 because the variable ori31_emitted is set but never used if CONFIG_PPC_BOOK3S_64=n. Without this patch: $ make -j $(nproc) W=1 ARCH=powerpc SHELL=/bin/bash arch/powerpc/net [...] CC arch/powerpc/net/bpf_jit_comp.o CC arch/powerpc/net/bpf_jit_comp64.o ../arch/powerpc/net/bpf_jit_comp64.c: In function 'bpf_jit_build_body': ../arch/powerpc/net/bpf_jit_comp64.c:417:28: warning: variable 'ori31_emitted' set but not used [-Wunused-but-set-variable] 417 | bool sync_emitted, ori31_emitted; | ^~~~~~~~~~~~~ AR arch/powerpc/net/built-in.a With this patch: [...] CC arch/powerpc/net/bpf_jit_comp.o CC arch/powerpc/net/bpf_jit_comp64.o AR arch/powerpc/net/built-in.a Fixes: dff883d ("bpf, arm64, powerpc: Change nospec to include v1 barrier") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Luis Gerhorst <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent cd7312a commit e30329b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -820,13 +820,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
820820
case BPF_ST | BPF_NOSPEC:
821821
sync_emitted = false;
822822
ori31_emitted = false;
823-
#ifdef CONFIG_PPC_E500
824-
if (!bpf_jit_bypass_spec_v1()) {
823+
if (IS_ENABLED(CONFIG_PPC_E500) &&
824+
!bpf_jit_bypass_spec_v1()) {
825825
EMIT(PPC_RAW_ISYNC());
826826
EMIT(PPC_RAW_SYNC());
827827
sync_emitted = true;
828828
}
829-
#endif
830829
if (!bpf_jit_bypass_spec_v4()) {
831830
switch (stf_barrier) {
832831
case STF_BARRIER_EIEIO:
@@ -849,10 +848,10 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
849848
break;
850849
}
851850
}
852-
#ifdef CONFIG_PPC_BOOK3S_64
853-
if (!bpf_jit_bypass_spec_v1() && !ori31_emitted)
851+
if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
852+
!bpf_jit_bypass_spec_v1() &&
853+
!ori31_emitted)
854854
EMIT(PPC_RAW_ORI(_R31, _R31, 0));
855-
#endif
856855
break;
857856

858857
/*

0 commit comments

Comments
 (0)