Skip to content

Commit 285672f

Browse files
chleroympe
authored andcommitted
powerpc/code-patching: Fix error handling in do_patch_instruction()
Use real errors instead of using -1 as error, so that errors returned by callees can be used towards callers. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/85259d894069e47f915ea580b169e1adbeec7a61.1638446239.git.christophe.leroy@csgroup.eu
1 parent af5304a commit 285672f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/powerpc/lib/code-patching.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,13 @@ void __init poking_init(void)
8585
static int map_patch_area(void *addr, unsigned long text_poke_addr)
8686
{
8787
unsigned long pfn;
88-
int err;
8988

9089
if (is_vmalloc_or_module_addr(addr))
9190
pfn = vmalloc_to_pfn(addr);
9291
else
9392
pfn = __pa_symbol(addr) >> PAGE_SHIFT;
9493

95-
err = map_kernel_page(text_poke_addr, (pfn << PAGE_SHIFT), PAGE_KERNEL);
96-
97-
if (err)
98-
return -1;
99-
100-
return 0;
94+
return map_kernel_page(text_poke_addr, (pfn << PAGE_SHIFT), PAGE_KERNEL);
10195
}
10296

10397
static inline int unmap_patch_area(unsigned long addr)
@@ -156,10 +150,9 @@ static int do_patch_instruction(u32 *addr, ppc_inst_t instr)
156150
local_irq_save(flags);
157151

158152
text_poke_addr = (unsigned long)__this_cpu_read(text_poke_area)->addr;
159-
if (map_patch_area(addr, text_poke_addr)) {
160-
err = -1;
153+
err = map_patch_area(addr, text_poke_addr);
154+
if (err)
161155
goto out;
162-
}
163156

164157
patch_addr = (u32 *)(text_poke_addr + (kaddr & ~PAGE_MASK));
165158

0 commit comments

Comments
 (0)