All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: eric.auger@redhat.com
Cc: alex.williamson@redhat.com, philmd@redhat.com,
	Qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 7/7] vfio: platform: destory mutex in error path
Date: Mon, 22 Oct 2018 09:57:41 +0800	[thread overview]
Message-ID: <CAKXe6SLaS26Amv7cryLkNRfyoFjFofjBsn7yfbVHsr16C9uhtw@mail.gmail.com> (raw)
In-Reply-To: <95818941-44e4-c9fa-6d54-57c909732432@redhat.com>

Hello Auger,

Auger Eric <eric.auger@redhat.com> 于2018年10月20日周六 上午12:41写道:

> Hi Li,
>
> On 10/19/18 7:20 AM, Li Qiang wrote:
> > Signed-off-by: Li Qiang <liq3ea@gmail.com>
> > ---
> >  hw/vfio/platform.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
> > index ba19143..e9d9e80 100644
> > --- a/hw/vfio/platform.c
> > +++ b/hw/vfio/platform.c
> > @@ -668,7 +668,7 @@ static void vfio_platform_realize(DeviceState *dev,
> Error **errp)
> >              error_setg(errp, "%s", gerr->message);
> >              g_error_free(gerr);
> >              g_free(path);
> > -            return;
> > +            goto out;
> You must set ret to != 0 otherwise the qemu_mutex_destroy will not be
> reached I think.

Also this will fix the fact we are not prepending the
> vfio error prefix in that case, as we should.
>
> Besides I am unsure about the cleanup strategy in case or error in
> vfio_platform_realize(). The qemu process should always exit in case of
> failure in vfio_platform_realize(). Platform devices can only be
> cold-plugged through the qemu CLI.


Got this.


> Cleaning all the allocated resources
> may add a substantial amount of code.


Agree.


Thanks,
Li Qiang


> For instance resources allocated
> in vfio_base_device_init() are not freed either. Comprehensive free in
> realize() functions may only be needed in case of hotplug I think.
>
> Thanks
>
> Eric
> >          }
> >          g_free(path);
> >          vdev->compat = contents;
> > @@ -691,6 +691,8 @@ out:
> >          return;
> >      }
> >
> > +    qemu_mutex_destroy(&vdev->intp_mutex);
> > +
> >      if (vdev->vbasedev.name) {
> >          error_prepend(errp, ERR_PREFIX, vdev->vbasedev.name);
> >      } else {
> >
>

  reply	other threads:[~2018-10-22  2:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19  5:20 [Qemu-devel] [PATCH 0/7] vfio: some trivial fixes Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 1/7] vfio-pci: make "vfio-pci-nohotplug" as MACRO Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 2/7] vfio: ap-device: make it more QOMConventional Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 3/7] vfio: drop TYPE_FOO MACRO in VMStateDescription Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 4/7] vfio: paltform: fix a typo Li Qiang
2018-10-19  5:23   ` Philippe Mathieu-Daudé
2018-10-19 16:41   ` Auger Eric
2018-10-19  5:20 ` [Qemu-devel] [PATCH 5/7] vfio: platform: cleanup the notifier in error path Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 6/7] vfio: platform: free timer " Li Qiang
2018-10-19  5:20 ` [Qemu-devel] [PATCH 7/7] vfio: platform: destory mutex " Li Qiang
2018-10-19 16:41   ` Auger Eric
2018-10-22  1:57     ` Li Qiang [this message]
2018-10-19  5:25 ` [Qemu-devel] [PATCH 0/7] vfio: some trivial fixes Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKXe6SLaS26Amv7cryLkNRfyoFjFofjBsn7yfbVHsr16C9uhtw@mail.gmail.com \
    --to=liq3ea@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.