On 04/05/20 16:38, Markus Armbruster wrote:
> makes no progreess because OBJECT(dev)->parent is still null, and
> therefore object_unparent() does nothing.
> 
> Possible culprit: qdev_try_create() calls qdev_set_parent_bus(), which
> adds the device to the bus, but leaves ->parent null.  If this isn't
> wrong outright, it's at least a dangerous state.
> 
> Work-around: call qdev_set_id(dev, NULL) right after qdev_create().
> This sets ->parent.

That's a good one, and especially a safe one, since it matches
qdev_device_add.  It has the disadvantage of having to touch all
qdev_create() calls.

Even better however would be to move the bus argument (and thus
qdev_set_parent_bus) to qdev_init, and likewise in qdev_device_add move
qdev_set_id after qemu_opt_foreach.  I looked at the property setters
and couldn't find anything suspicious (somewhat to my surprise), but I
haven't honestly tried.

Paolo


Reply via email to