By checking the return value from kvm_ipc__register_handler, we can ensure that it succeeds. Signed-off-by: Yang Bai <hamo.by@xxxxxxxxx> --- tools/kvm/kvm.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index f02d5df..99bcef4 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -396,10 +396,16 @@ struct kvm *kvm__init(const char *kvm_dev, const char *hugetlbfs_path, u64 ram_s goto err_vm_fd; } - kvm_ipc__register_handler(KVM_IPC_PID, kvm__pid); + ret = kvm_ipc__register_handler(KVM_IPC_PID, kvm__pid); + if (ret < 0) { + pr_err("Register ipc handler failed."); + goto err_ipc; + } return kvm; +err_ipc: + kvm_ipc__stop(); err_vm_fd: close(kvm->vm_fd); err_sys_fd: -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html