[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250111171312.1513926-1-eleanor15x@gmail.com>
Date: Sun, 12 Jan 2025 01:13:12 +0800
From: Yu-Chun Lin <eleanor15x@...il.com>
To: maddy@...ux.ibm.com,
mpe@...erman.id.au,
npiggin@...il.com,
christophe.leroy@...roup.eu,
naveen@...nel.org
Cc: linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org,
visitorckw@...il.com,
jserv@...s.ncku.edu.tw,
Yu-Chun Lin <eleanor15x@...il.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH] powerpc: Fix warning with '__powerpc64__'
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@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501100247.gEmkqu8j-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@...il.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
Powered by blists - more mailing lists