On 11.07.2018 19:20, Paolo Bonzini wrote: > On 09/07/2018 23:03, Thomas Huth wrote: >> >> The problem is that qdev_set_parent_bus() from instance_init adds a link >> to the child devices which is not valid anymore after the device init >> failed. Thus the qdev_set_parent_bus() must rather be done in the realize >> function instead. > > The theoretical behavior should be: > > - realize fails
In this case, the failure is before realize is attempted, qdev_device_add() already stop with "Device '%s' can not be hotplugged on this machine". > - object_unparent is called on the device that failed to realize (see > qdev_device_add). object_unparent calls device_unparent Hmm, are you sure? I can see that object_unparent calls device_unparent indirectly for the *child* nodes of the device, but not for the device itself... Thomas