qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc.


From: Paolo Bonzini
Subject: Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc.
Date: Wed, 20 May 2020 18:28:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

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

[Prev in Thread] Current Thread [Next in Thread]