Steven Rostedt wrote:
On Fri, 24 Apr 2020 23:56:25 +0530
"Naveen N. Rao" <[email protected]> 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.
Ugh, you're right indeed. I clearly didn't think it through. :facepalm:
I'll use this variant.
Regards,
Naveen