[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 33/42] tpm-passthrough: remove error cleanup fro
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 33/42] tpm-passthrough: remove error cleanup from handle_device_opts |
Date: |
Tue, 10 Oct 2017 18:19:13 -0400 (EDT) |
Hi
----- Original Message -----
> On 10/09/2017 06:56 PM, Marc-André Lureau wrote:
> > Clean-up is handled by the create() function.
> >
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > ---
> > hw/tpm/tpm_passthrough.c | 15 ++-------------
> > 1 file changed, 2 insertions(+), 13 deletions(-)
> >
> > diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
> > index aa9167e3c6..0806cf86af 100644
> > --- a/hw/tpm/tpm_passthrough.c
> > +++ b/hw/tpm/tpm_passthrough.c
> > @@ -261,27 +261,16 @@ tpm_passthrough_handle_device_opts(TPMPassthruState
> > *tpm_pt, QemuOpts *opts)
> > if (tpm_pt->tpm_fd < 0) {
> > error_report("Cannot access TPM device using '%s': %s",
> > tpm_pt->tpm_dev, strerror(errno));
> > - goto err_free_parameters;
> > + return -1;
> > }
> >
> > if (tpm_util_test_tpmdev(tpm_pt->tpm_fd, &tpm_pt->tpm_version)) {
> > error_report("'%s' is not a TPM device.",
> > tpm_pt->tpm_dev);
> > - goto err_close_tpmdev;
> > + return -1;
> > }
>
> I would prefer the cleanup to happen in the functions where the state is
> created...
This is the role for a destructor, no need to worry about local object change
cleanup.
I can drop the patch if you feel strongly about it, but I think it's a nice
code simplification.
[Qemu-devel] [PATCH 35/42] tpm-tis: simplify header inclusion, Marc-André Lureau, 2017/10/09
[Qemu-devel] [PATCH 34/42] tpm-passthrough: workaround a possible race, Marc-André Lureau, 2017/10/09
[Qemu-devel] [PATCH 36/42] tpm: rename qemu_find_tpm() -> qemu_find_tpm_be(), Marc-André Lureau, 2017/10/09
[Qemu-devel] [PATCH 37/42] tpm: lookup the the TPM interface instead of TIS device, Marc-André Lureau, 2017/10/09