提交 0bd6c8a9 编写于 作者: M Marc-André Lureau 提交者: Stefan Berger

tpm-be: report error instead of front-end

Backend can give more accurate error description, and lift out the job
from the frontend.
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
上级 68999059
......@@ -54,9 +54,10 @@ enum TpmType tpm_backend_get_type(TPMBackend *s)
return k->type;
}
int tpm_backend_init(TPMBackend *s, TPMIf *tpmif)
int tpm_backend_init(TPMBackend *s, TPMIf *tpmif, Error **errp)
{
if (s->tpmif) {
error_setg(errp, "TPM backend '%s' is already initialized", s->id);
return -1;
}
......
......@@ -1074,9 +1074,7 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
s->be_driver->fe_model = TPM_MODEL_TPM_TIS;
if (tpm_backend_init(s->be_driver, TPM_IF(s))) {
error_setg(errp, "tpm_tis: backend driver with id %s could not be "
"initialized", s->backend);
if (tpm_backend_init(s->be_driver, TPM_IF(s), errp)) {
return;
}
......
......@@ -99,12 +99,13 @@ enum TpmType tpm_backend_get_type(TPMBackend *s);
* @s: the backend to initialized
* @tpmif: TPM interface
* @datacb: callback for sending data to frontend
* @errp: a pointer to return the #Error object if an error occurs.
*
* Initialize the backend with the given variables.
*
* Returns 0 on success.
*/
int tpm_backend_init(TPMBackend *s, TPMIf *tpmif);
int tpm_backend_init(TPMBackend *s, TPMIf *tpmif, Error **errp);
/**
* tpm_backend_startup_tpm:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册