Skip to content

Commit 4774248

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: Remove extra variable in patch_text_nosync()
This cast is superfluous, and is incorrect anyway if compressed instructions may be present. Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20240327160520.791322-8-samuel.holland@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent eaee548 commit 4774248

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

arch/riscv/kernel/patch.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,11 @@ NOKPROBE_SYMBOL(patch_insn_set);
186186

187187
int patch_text_set_nosync(void *addr, u8 c, size_t len)
188188
{
189-
u32 *tp = addr;
190189
int ret;
191190

192-
ret = patch_insn_set(tp, c, len);
193-
191+
ret = patch_insn_set(addr, c, len);
194192
if (!ret)
195-
flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len);
193+
flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
196194

197195
return ret;
198196
}
@@ -224,13 +222,11 @@ NOKPROBE_SYMBOL(patch_insn_write);
224222

225223
int patch_text_nosync(void *addr, const void *insns, size_t len)
226224
{
227-
u32 *tp = addr;
228225
int ret;
229226

230-
ret = patch_insn_write(tp, insns, len);
231-
227+
ret = patch_insn_write(addr, insns, len);
232228
if (!ret)
233-
flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len);
229+
flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
234230

235231
return ret;
236232
}

0 commit comments

Comments
 (0)