On 07/07/17 15:48, Eduardo Habkost wrote: >>> I don't see what needs to be fixed. It is not a bug to leave >>> fw_cfg in /machine/unattached, as long as fw_cfg_find() works >>> properly. >> >> Yeah. I wonder if I've been leading myself astray down the wrong path >> here? Let me do some more local tests without >> fw_cfg_unattached_at_realize() and with an ambiguous argument in >> fw_cfg_find(). > > Note that if you add assert(!ambiguous) to fw_cfg_find(), you > need to choose what to do when multiple devices are instantiated: > a) Calling fw_cfg_find() on realize, making it abort instead of > returning an error; > b) Not calling fw_cfg_find() on realize, and returning an error > using object_resolve_path_type() manually; > c) Not calling fw_cfg_find(), not returning an error, and letting > QEMU abort when fw_cfg_find() is called by other code. > > I think it's simpler to just do like vmgenid does and simply > return NULL when there are multiple devices. We just need to > document that clearly, and be aware of that when calling > fw_cfg_find() on realize. But I won't object if you choose > another option.
Yes, I agree. I should add that I've been testing without the ambiguous argument and everything seems to be working now... ATB, Mark.