qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qdev_try_create(): Assert that devices we put o


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] qdev_try_create(): Assert that devices we put onto the system bus are SysBusDevices
Date: Wed, 16 Mar 2016 14:25:44 +0000

On 16 March 2016 at 14:14, Andreas Färber <address@hidden> wrote:
> Am 16.03.2016 um 15:11 schrieb Peter Maydell:
>> If qdev_try_create() is passed NULL for the bus, it will automatically
>> put the newly created device onto the default system bus. However
>> if the device is not actually a SysBusDevice then this will result
>> in later crashes (for instance when running the monitor "info qtree"
>> command) because code reasonably assumes that all devices on the system
>> bus are system bus devices.
>>
>> Generally the mistake is that the calling code should create the
>> object with object_new(TYPE_FOO) rather than qdev_create(NULL, TYPE_FOO);
>> see commit 6749695eaaf346c1 for an example of fixing this bug.
>>
>> Assert in qdev_try_create() if the device isn't suitable to put on
>> the system bus, so that this mistake results in failure earlier
>> and more reliably.
>>
>> Signed-off-by: Peter Maydell <address@hidden>
>> ---
>> This needs to go in after http://patchwork.ozlabs.org/patch/597716/
>> as otherwise the bug fixed by that patch will become a 'make check'
>> failure.
>
> Looks strange, but okay,

You mean the way we use what looks like a cast macro and ignore
the result? Yeah, I thought that was a little odd-looking. Happy
to do it some other way if you have an alternative suggestion.

> Reviewed-by: Andreas Färber <address@hidden>
>
> Through whose queue?

I'm happy to take it via the target-arm queue, since I was planning
to take the sd.c fix that way and this one needs to go after it,
if that works for you.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]