All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 05/21] char: add a /chardevs container
Date: Tue, 28 Feb 2017 10:34:46 +0000	[thread overview]
Message-ID: <CAJ+F1CKV9VUn9ahM6w6rSOGd8dMdX+4UZU7kPAU_-1MdgafyCg@mail.gmail.com> (raw)
In-Reply-To: <62892df9-9e1e-8e4c-c4f0-f3c6cf0422c7@redhat.com>

On Mon, Feb 27, 2017 at 8:01 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

>
>
> On 27/02/2017 14:41, Marc-André Lureau wrote:
> >
> > -    chr = CHARDEV(object_new(typename));
> > +    if (id) {
> > +        obj = object_new_with_props(typename, get_chardevs_root(),
> > +                                    id, &local_err, NULL);
> > +    } else {
> > +        obj = object_new(typename);
> > +    }
>
> I think you should open code object_new_with_props.  This can be just
> object_new(typename)...
>
>
Yes, it simplies things. Done. Any other remark about the rest of the
series? probably not worth a resend yet.

thanks


> > +    if (local_err) {
> > +        assert(!obj);
> > +        goto end;
> > +    }
> > +
> > +    chr = CHARDEV(obj);
> >      chr->label = g_strdup(id);
> >
> >      qemu_char_open(chr, backend, &be_opened, &local_err);
> >      if (local_err) {
> > -        error_propagate(errp, local_err);
> > -        object_unref(OBJECT(chr));
> > -        return NULL;
> > +        goto end;
> >      }
> >
> >      if (!chr->filename) {
> > @@ -1250,6 +1263,18 @@ Chardev *qemu_chardev_new(const char *id, const
> char *typename,
> >          qemu_chr_be_event(chr, CHR_EVENT_OPENED);
> >      }
> >
> > +end:
> > +    if (local_err) {
> > +        error_propagate(errp, local_err);
> > +        if (chr) {
> > +            if (id) {
> > +                object_unparent(OBJECT(chr));
> > +            } else {
> > +                object_unref(OBJECT(chr));
> > +            }
>
> Then here you do not have a parent object and you can do only unref...
>
> > +        }
> > +        return NULL;
> > +    }
>
> ... while here you do the object_property_add_child+object_unref.  The
> object_property_add_child keeps the object alive, while object_unref
> drops the reference originally returned by object_new.
>
> Paolo
>
> --
Marc-André Lureau

  reply	other threads:[~2017-02-28 10:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 13:41 [Qemu-devel] [PATCH v2 00/21] chardev clean-ups & tests Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 01/21] char: remove qemu_chr_be_generic_open Marc-André Lureau
2017-03-01  1:57   ` Eric Blake
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 02/21] mux: simplfy muxes_realize_done Marc-André Lureau
2017-03-01 19:51   ` Eric Blake
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 03/21] xen: use a better chardev type check Marc-André Lureau
2017-03-01 20:06   ` Eric Blake
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 04/21] container: don't leak container reference Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 05/21] char: add a /chardevs container Marc-André Lureau
2017-02-27 15:39   ` Paolo Bonzini
2017-02-28 10:34     ` Marc-André Lureau [this message]
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 06/21] vl: add todo note about root container cleanup Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 07/21] char: use /chardevs container instead of chardevs list Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 08/21] char: remove qemu_chardev_add Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 09/21] char: remove chardevs list Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 10/21] char: useless NULL check Marc-André Lureau
2017-03-01  4:32   ` Philippe Mathieu-Daudé
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 11/21] char-socket: introduce update_disconnected_filename() Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 12/21] char-socket: update local address after listen Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 13/21] char-socket: add 'addr' property Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 14/21] char-socket: add 'connected' property Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 15/21] char-udp: flush as much buffer as possible Marc-André Lureau
2017-03-01  4:34   ` Philippe Mathieu-Daudé
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 16/21] tests: add alias check in /char/ringbuf Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 17/21] tests: add /char/pipe test Marc-André Lureau
2017-02-27 13:41 ` [Qemu-devel] [PATCH v2 18/21] tests: add /char/file test Marc-André Lureau
2017-02-27 13:42 ` [Qemu-devel] [PATCH v2 19/21] tests: add /char/socket test Marc-André Lureau
2017-02-27 13:42 ` [Qemu-devel] [PATCH v2 20/21] tests: add /char/udp test Marc-André Lureau
2017-02-27 13:42 ` [Qemu-devel] [PATCH v2 21/21] tests: add /char/console test Marc-André Lureau
2017-05-03 12:36 ` [Qemu-devel] [PATCH v2 00/21] chardev clean-ups & tests Paolo Bonzini

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=CAJ+F1CKV9VUn9ahM6w6rSOGd8dMdX+4UZU7kPAU_-1MdgafyCg@mail.gmail.com \
    --to=marcandre.lureau@gmail.com \
    --cc=pbonzini@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.