Sounds like a good idea. Much easier to fix a problem with an explicit error than to chase a seg fault.
On 15 March 2016 at 14:41, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 15 March 2016 at 20:33, Peter Maydell <peter.mayd...@linaro.org> wrote: >> On 15 March 2016 at 20:28, Thomas Hanson <thomas.han...@linaro.org> wrote: >>> The patch looks good. >>> >>> Would it also be good to update bus_add_child() so that it NULL-checks >>> its "bus" parameter before dereferencing it? >> >> No, I think it's just a programming error to call qdev_set_parent_bus() >> with a NULL bus parameter, so crashing is fine. > > ...but it might be helpful to assert in qdev_try_create() that > if we're using the default bus then the object is a sysbus > device object. At least then the problem will be immediately > clear rather than only showing up if you run a monitor command > later. > > thanks > -- PMM