powerpc/code-patching: Fix patch_branch() return on out-of-range failure

Do not silentely ignore a failure of create_branch() in
patch_branch(). Return -ERANGE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/8540cb64b1f06710eaf41e3835c7ba3e21fa2b05.1638446239.git.christophe.leroy@csgroup.eu
This commit is contained in:
Christophe Leroy 2021-12-02 13:00:22 +01:00 committed by Michael Ellerman
parent 6b21af7449
commit d5937db114

View file

@ -191,7 +191,9 @@ int patch_branch(u32 *addr, unsigned long target, int flags)
{
ppc_inst_t instr;
create_branch(&instr, addr, target, flags);
if (create_branch(&instr, addr, target, flags))
return -ERANGE;
return patch_instruction(addr, instr);
}