fix compile error

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Check whether ring buffer already is allocated

We need to check whether ring buffer is allocated before
trying to free it.

I tried to add ktap to my board, but I ran into the following calltrace,
this patch is to fix it.

ktap: cannot lookup ftrace_find_event in kallsyms
Cannot open file /sys/kernel/debug/ktap/trace_pipe_1643
Unable to handle kernel paging request for data at address 0x00000010
Faulting instruction address: 0xc0000000004933dc
Oops: Kernel access of bad area, sig: 11 [#1]
PREEMPT SMP NR_CPUS=24 LTT NESTING LEVEL : 0
T4240 QDS
Modules linked in: ktapvm(O) [last unloaded: ktapvm]
NIP: c0000000004933dc LR: c0000000001125b0 CTR: c000000000112540
REGS: c0000005f576f5f0 TRAP: 0300   Tainted: G           O  (3.4.43-WR5.0.1.0_standard)
MSR: 0000000080029000 <CE,EE,ME>  CR: 24000444  XER: 00000000
SOFTE: 1
DEAR: 0000000000000010, ESR: 0000000000000000
TASK = c0000005f4725200[1643] 'ktap' THREAD: c0000005f576c000 CPU: 2
GPR00: 0000000000000000 c0000005f576f870 c000000000ce4328 0000000000000010
GPR04: 0000000000000000 0000000000000000 0000000024000424 c00000000000a12c
GPR08: 0000000000000000 0000000000000018 0000000000000000 0000000000000010
GPR12: 80000000003be4b0 c00000000fffa800 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 00000000100c7c48 00000000101179e8
GPR20: 00000000100f0000 c000000000b77bc0 0000000000000000 0000000000000000
GPR24: 0000000000000003 0000000000000000 0000000000000000 ffffffffffffffff
GPR28: 0000000000000010 c000000000cf3a9c c000000000c2c1a8 0000000000000000
NIP [c0000000004933dc] .find_next_bit+0x7c/0x110
LR [c0000000001125b0] .ring_buffer_free+0x70/0xd0
Call Trace:
[c0000005f576f870] [c000000000112580] .ring_buffer_free+0x40/0xd0 (unreliable)
[c0000005f576f910] [80000000003b9440] .kp_transport_exit+0x20/0x50 [ktapvm]
[c0000005f576f990] [80000000003bd628] .kp_final_exit+0x408/0x450 [ktapvm]
[c0000005f576fa60] [80000000003bddd8] .kp_newstate+0x728/0x770 [ktapvm]
[c0000005f576fb70] [80000000003bde6c] .ktap_main+0x4c/0x190 [ktapvm]
[c0000005f576fc10] [80000000003be06c] .compat_ktap_ioctl+0xbc/0xe0 [ktapvm]
[c0000005f576fcf0] [c000000000215428] .compat_sys_ioctl+0x388/0x1ae0
[c0000005f576fe30] [c000000000000598] syscall_exit+0x0/0x60
Instruction dump:
60000000 e80b0000 396b0008 2fa00000 409e0038 3929ffc0 38a50040 79200665
4082ffe4 2fa90000 7ca42b78 419e0034 <e80b0000> 21690040 3940ffff 7d4b5c36
---[ end trace f3e31e8a981317f6 ]---

Signed-off-by: Yang Wei <w90p710@gmail.com>
Using a correct symbol name to look up its address for PPC64

For PPC64, the PPC64 ABI introduces function descriptor, it
is a three doubleword data structure. Its first doubleword
contains the address of the entry point of the function.

The value of the symbol with the same name as the function
is the address of function descriptor, Conversely, Symbol names
with a dot(.) prefix are real entry point addresses.

Signed-off-by: Yang Wei <w90p710@gmail.com>
Remake ktap whenever flags are changed

Save build flags into KTAP-FLAGS, and remake when it is different
from the last time.