diff options
Diffstat (limited to 'arch/powerpc/lib/code-patching.c')
-rw-r--r-- | arch/powerpc/lib/code-patching.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 7c975d43e3f3..dd223b3eb333 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c | |||
@@ -13,17 +13,23 @@ | |||
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | #include <asm/code-patching.h> | 15 | #include <asm/code-patching.h> |
16 | #include <asm/uaccess.h> | ||
16 | 17 | ||
17 | 18 | ||
18 | void patch_instruction(unsigned int *addr, unsigned int instr) | 19 | int patch_instruction(unsigned int *addr, unsigned int instr) |
19 | { | 20 | { |
20 | *addr = instr; | 21 | int err; |
22 | |||
23 | err = __put_user(instr, addr); | ||
24 | if (err) | ||
25 | return err; | ||
21 | asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr)); | 26 | asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr)); |
27 | return 0; | ||
22 | } | 28 | } |
23 | 29 | ||
24 | void patch_branch(unsigned int *addr, unsigned long target, int flags) | 30 | int patch_branch(unsigned int *addr, unsigned long target, int flags) |
25 | { | 31 | { |
26 | patch_instruction(addr, create_branch(addr, target, flags)); | 32 | return patch_instruction(addr, create_branch(addr, target, flags)); |
27 | } | 33 | } |
28 | 34 | ||
29 | unsigned int create_branch(const unsigned int *addr, | 35 | unsigned int create_branch(const unsigned int *addr, |