[PATCH 3/3] powerpc/kprobes: Check return value of patch_instruction()
Steven Rostedt
rostedt at goodmis.org
Sat Apr 25 04:31:19 AEST 2020
On Fri, 24 Apr 2020 23:56:25 +0530
"Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:
> > #define PATCH_INSN(addr, instr) \
> > ({
> > int rc = patch_instruction((unsigned int *)(addr), instr); \
> > if (rc) \
> > pr_err("%s:%d Error patching instruction at 0x%pK (%pS): %d\n", \
> > __func__, __LINE__, \
> > (void *)(addr), (void *)(addr), rc); \
> > rc; \
> > })
> >
> >
> > Then you can just do:
> >
> > ret = PATCH_INSN(...);
> > if (ret)
> > return ret;
> >
> > in the code.
>
> That's really nice. However, in this case, I guess I can simply use an
> inline function? The primary reason I used the macro was for including a
> 'return' statement in it.
I thought the primary reason was the __func__, __LINE__ which wont work as
expected as an inline.
-- Steve
More information about the Linuxppc-dev
mailing list