diff options
author | Amarnath Valluri <amarnath.valluri@intel.com> | 2017-09-29 14:10:15 +0300 |
---|---|---|
committer | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2017-10-13 07:34:33 -0400 |
commit | f35fe5cb97bbdaa6a6967f2fefc3fc1f79680601 (patch) | |
tree | 2bbd77327a4d5de1192173a5ec06ffe5ce42a1d1 /backends | |
parent | b19a5eea5a26e9bd83a48c742172d2a6aa8c4180 (diff) |
tpm-backend: Initialize and free data members in it's own methods
Initialize and free TPMBackend data members in it's own instance_init() and
instance_finalize methods.
Took the opportunity to remove unneeded destroy() method from TpmDriverOps
interface as TPMBackend is a Qemu Object, we can use object_unref() inplace of
tpm_backend_destroy() to free the backend object, hence removed destroy() from
TPMDriverOps interface.
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/tpm.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/backends/tpm.c b/backends/tpm.c index ce56c3b74d..cf5abf1582 100644 --- a/backends/tpm.c +++ b/backends/tpm.c @@ -51,15 +51,6 @@ const char *tpm_backend_get_desc(TPMBackend *s) return k->ops->desc(); } -void tpm_backend_destroy(TPMBackend *s) -{ - TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); - - k->ops->destroy(s); - - tpm_backend_thread_end(s); -} - int tpm_backend_init(TPMBackend *s, TPMState *state, TPMRecvDataCB *datacb) { @@ -182,17 +173,22 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp) static void tpm_backend_instance_init(Object *obj) { + TPMBackend *s = TPM_BACKEND(obj); + object_property_add_bool(obj, "opened", tpm_backend_prop_get_opened, tpm_backend_prop_set_opened, NULL); - + s->fe_model = -1; } static void tpm_backend_instance_finalize(Object *obj) { TPMBackend *s = TPM_BACKEND(obj); + g_free(s->id); + g_free(s->path); + g_free(s->cancel_path); tpm_backend_thread_end(s); } |