Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-05 Thread Markus Armbruster
Paolo Bonzini writes: > Are we sure that qdev_realize is never called with user-provided input? If The only way to call qdev_realize() with a user-provided bus is -device / device_add via qdev_device_add(). qdev_device_add() carefully checks the user-provided bus before passing it to qdev_reali

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-05 Thread Philippe Mathieu-Daudé
On 7/5/20 1:14 PM, Paolo Bonzini wrote: > Are we sure that qdev_realize is never called with user-provided input? I am not sure, but ... > If it's a programming error, the call chain will end up passing > &error_abort anyway, won't it? ... this is a good point :) > > Paolo > > Il dom 5 lug 20

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-05 Thread Paolo Bonzini
Are we sure that qdev_realize is never called with user-provided input? If it's a programming error, the call chain will end up passing &error_abort anyway, won't it? Paolo Il dom 5 lug 2020, 12:05 Philippe Mathieu-Daudé ha scritto: > On 7/5/20 7:46 AM, Paolo Bonzini wrote: > > On 20/06/20 17:3

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-05 Thread Philippe Mathieu-Daudé
On 7/5/20 7:46 AM, Paolo Bonzini wrote: > On 20/06/20 17:38, Philippe Mathieu-Daudé wrote: >> -} else { >> -assert(!DEVICE_GET_CLASS(dev)->bus_type); >> +} else if (DEVICE_GET_CLASS(dev)->bus_type) { >> +error_report("%s: Unexpected bus '%s' for device '%s'", >> +

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-04 Thread Paolo Bonzini
On 20/06/20 17:38, Philippe Mathieu-Daudé wrote: > -} else { > -assert(!DEVICE_GET_CLASS(dev)->bus_type); > +} else if (DEVICE_GET_CLASS(dev)->bus_type) { > +error_report("%s: Unexpected bus '%s' for device '%s'", > + __func__, DEVICE_GET_CLASS(dev)->bus_

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-07-04 Thread Philippe Mathieu-Daudé
ping? On 6/20/20 5:38 PM, Philippe Mathieu-Daudé wrote: > Since commit 510ef98dca5, qdev_realize() aborts if bus-less > device is realized on a bus. Be kind with the developer by > displaying a hint about what is wrong. > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/core/qdev.c | 7 +-

[PATCH] hw/core/qdev: Increase qdev_realize() kindness

2020-06-20 Thread Philippe Mathieu-Daudé
Since commit 510ef98dca5, qdev_realize() aborts if bus-less device is realized on a bus. Be kind with the developer by displaying a hint about what is wrong. Signed-off-by: Philippe Mathieu-Daudé --- hw/core/qdev.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/cor