* [PATCH RESEND] powerpc: Fix compiler warning by guarding with '__powerpc64__'
@ 2025-02-17 16:43 Yu-Chun Lin
0 siblings, 0 replies; only message in thread
From: Yu-Chun Lin @ 2025-02-17 16:43 UTC (permalink / raw)
To: maddy, mpe, npiggin, christophe.leroy, naveen
Cc: linuxppc-dev, linux-kernel, visitorckw, jserv, Yu-Chun Lin,
kernel test robot
As reported by the kernel test robot, the following error occurs:
arch/powerpc/lib/sstep.c: In function 'analyse_instr':
>> arch/powerpc/lib/sstep.c:1172:28: warning: variable 'suffix' set but not used [-Wunused-but-set-variable]
1172 | unsigned int word, suffix;
| ^~~~~~
arch/powerpc/lib/sstep.c:1168:38: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
1168 | unsigned int opcode, ra, rb, rc, rd, spr, u;
| ^~
These variables are now conditionally defined with the '__powerpc64__'
macro to ensure they are only used when applicable.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501100247.gEmkqu8j-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
---
arch/powerpc/lib/sstep.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index ac3ee19531d8..eea8653464e7 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1354,15 +1354,21 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
#ifdef CONFIG_PPC64
unsigned int suffixopcode, prefixtype, prefix_r;
#endif
- unsigned int opcode, ra, rb, rc, rd, spr, u;
+ unsigned int opcode, ra, rb, rd, spr, u;
unsigned long int imm;
unsigned long int val, val2;
unsigned int mb, me, sh;
- unsigned int word, suffix;
+ unsigned int word;
+#ifdef __powerpc64__
+ unsigned int suffix;
+ unsigned int rc;
+#endif
long ival;
word = ppc_inst_val(instr);
+#ifdef __powerpc64__
suffix = ppc_inst_suffix(instr);
+#endif
op->type = COMPUTE;
@@ -1480,7 +1486,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
rd = (word >> 21) & 0x1f;
ra = (word >> 16) & 0x1f;
rb = (word >> 11) & 0x1f;
+#ifdef __powerpc64__
rc = (word >> 6) & 0x1f;
+#endif
switch (opcode) {
#ifdef __powerpc64__
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-17 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 16:43 [PATCH RESEND] powerpc: Fix compiler warning by guarding with '__powerpc64__' Yu-Chun Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox