On 20/05/20 16:42, Markus Armbruster wrote:
> If something goes
> wrong there, we execute
> 
>     fail:
>         error_propagate(errp, local_err);
>         if (unattached_parent) {
>             /*
>              * Beware, this doesn't just revert
>              * object_property_add_child(), it also runs bus_remove()!
>              */
>             object_unparent(OBJECT(dev));
>             unattached_count--;
>         }
> 
> and bus_remove() drops the reference count to zero.

Whoa whoa...  I didn't expect this from a failure to realize.

I think we should move the whole /machine/unattached dance into
qdev_realize, and just assert that a device being realized already has a
parent.  Then the ref/unref _will_ be unnecessary.  In the meanwhile, I
agree to either keep it or move it inside device_set_realized.

Thanks,

Paolo


Reply via email to