qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
	berrange@redhat.com, ehabkost@redhat.com, armbru@redhat.com
Subject: Re: [PATCH v2 1/2] qom: Introduce object_property_try_add_child()
Date: Wed, 24 Jun 2020 18:02:54 +0200	[thread overview]
Message-ID: <430f6b32-8456-ac1d-72b3-85e0e59ae9b5@redhat.com> (raw)
In-Reply-To: <2bf606dd-4ed3-ec65-3dc2-72089bc7cef5@redhat.com>

Hi Paolo,

On 6/24/20 4:17 PM, Auger Eric wrote:
> Hi Paolo,
> 
> On 6/24/20 4:12 PM, Paolo Bonzini wrote:
>> On 24/06/20 14:43, Eric Auger wrote:
>>> +    op = object_property_try_add(obj, name, type, object_get_child_property,
>>> +                                 NULL, object_finalize_child_property,
>>> +                                 child, errp);
>>> +    if (!op) {
>>> +        goto out;
>>> +    }
>>>      op->resolve = object_resolve_child_property;
>>> +out:
>>>      object_ref(child);
>>>      child->parent = obj;
>>>      return op;
>>
>> I think if there's an error you need to return NULL without ref-ing
>> child, shouldn't you?
> hum yes you're fully right, the out label is badly placed.
Looks the unref is done in user_creatable_add_type() in case of error.
Isn't it the corresponding one? Anyway I think it is better to avoid
getting the ref here as you suggest (and also free type) and don't unref
in user_creatable_add_type.

Thanks

Eric
>>
>> You can then add another test that object_property_add_child succeeds
>> after object_property_try_add_child fails.
> OK
> 
> Thanks
> 
> Eric
>>
>> Paolo
>>



  reply	other threads:[~2020-06-24 16:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 12:42 [PATCH v2 0/2] Avoid abort on QMP attempt to add an object with duplicate id Eric Auger
2020-06-24 12:43 ` [PATCH v2 1/2] qom: Introduce object_property_try_add_child() Eric Auger
2020-06-24 14:12   ` Paolo Bonzini
2020-06-24 14:17     ` Auger Eric
2020-06-24 16:02       ` Auger Eric [this message]
2020-06-24 16:16         ` Paolo Bonzini
2020-06-24 17:03           ` Auger Eric
2020-06-24 12:43 ` [PATCH v2 2/2] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id Eric Auger
2020-06-24 13:01   ` Thomas Huth
2020-06-24 16:13   ` Auger Eric
2020-06-24 13:35 ` [PATCH v2 0/2] Avoid abort on QMP attempt to add an object with duplicate id no-reply
2020-06-24 14:05   ` Auger Eric

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=430f6b32-8456-ac1d-72b3-85e0e59ae9b5@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=eric.auger.pro@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).