[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] target-i386: Clean up misuse of qdev_init()
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] target-i386: Clean up misuse of qdev_init() in realize method |
Date: |
Thu, 05 Feb 2015 19:28:50 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Am 05.02.2015 um 13:51 schrieb Igor Mammedov:
> On Thu, 5 Feb 2015 10:29:15 +0100
> Markus Armbruster <address@hidden> wrote:
>
>> x86_cpu_apic_realize() calls qdev_init() to realize the APIC.
>> qdev_init()'s error handling has unwanted side effects: it unparents
>> the device, and it calls qerror_report_err().
>>
>> qerror_report_err() is always inappropriate in realize methods,
>> because it doesn't return the Error object. It either reports the
>> error to stderr or the human monitor, or it stores it in the QMP
>> monitor, where it makes the QMP command fail even though the realize
>> method succeeded.
>>
>> Fortunately, qdev_init() can't actually fail here, because realize
>> can't fail for any of the three possible APIC device models.
>>
>> Clean up by cutting out the qdev_init() middle-man: set property
>> "realized" directly.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>
> Reviewed-by: Igor Mammedov <address@hidden>
Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)