[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 1/8] pc: local error handling in h
From: |
David Hildenbrand |
Subject: |
Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 1/8] pc: local error handling in hotplug handler functions |
Date: |
Fri, 8 Jun 2018 10:05:22 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 08.06.2018 10:04, Thomas Huth wrote:
> On 07.06.2018 18:52, David Hildenbrand wrote:
>> Let's introduce and use local error variables in the hotplug handler
>> functions.
>
> Why? You don't check local_err in the functions, so I fail to see why
> this is needed? If you need this in a later patch, I think this should
> simply be part of that later patch instead.
See the mail I sent a couple of minutes ago as reply to the cover
letter. Thanks.
>
> Thomas
>
>
>> Signed-off-by: David Hildenbrand <address@hidden>
>> ---
>> hw/i386/pc.c | 32 ++++++++++++++++++++++----------
>> 1 file changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index f3befe6721..8075c6af15 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -2006,45 +2006,57 @@ static void pc_cpu_pre_plug(HotplugHandler
>> *hotplug_dev,
>> static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
>> DeviceState *dev, Error **errp)
>> {
>> + Error *local_err = NULL;
>> +
>> if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>> - pc_cpu_pre_plug(hotplug_dev, dev, errp);
>> + pc_cpu_pre_plug(hotplug_dev, dev, &local_err);
>> }
>> + error_propagate(errp, local_err);
>> }
>>
>> static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
>> DeviceState *dev, Error **errp)
>> {
>> + Error *local_err = NULL;
>> +
>> if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
>> - pc_dimm_plug(hotplug_dev, dev, errp);
>> + pc_dimm_plug(hotplug_dev, dev, &local_err);
>> } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>> - pc_cpu_plug(hotplug_dev, dev, errp);
>> + pc_cpu_plug(hotplug_dev, dev, &local_err);
>> }
>> + error_propagate(errp, local_err);
>> }
>>
>> static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
>> DeviceState *dev, Error
>> **errp)
>> {
>> + Error *local_err = NULL;
>> +
>> if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
>> - pc_dimm_unplug_request(hotplug_dev, dev, errp);
>> + pc_dimm_unplug_request(hotplug_dev, dev, &local_err);
>> } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>> - pc_cpu_unplug_request_cb(hotplug_dev, dev, errp);
>> + pc_cpu_unplug_request_cb(hotplug_dev, dev, &local_err);
>> } else {
>> - error_setg(errp, "acpi: device unplug request for not supported
>> device"
>> - " type: %s", object_get_typename(OBJECT(dev)));
>> + error_setg(&local_err, "acpi: device unplug request for not
>> supported"
>> + " device type: %s", object_get_typename(OBJECT(dev)));
>> }
>> + error_propagate(errp, local_err);
>> }
>>
>> static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,
>> DeviceState *dev, Error **errp)
>> {
>> + Error *local_err = NULL;
>> +
>> if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
>> - pc_dimm_unplug(hotplug_dev, dev, errp);
>> + pc_dimm_unplug(hotplug_dev, dev, &local_err);
>> } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>> - pc_cpu_unplug_cb(hotplug_dev, dev, errp);
>> + pc_cpu_unplug_cb(hotplug_dev, dev, &local_err);
>> } else {
>> - error_setg(errp, "acpi: device unplug for not supported device"
>> + error_setg(&local_err, "acpi: device unplug for not supported
>> device"
>> " type: %s", object_get_typename(OBJECT(dev)));
>> }
>> + error_propagate(errp, local_err);
>> }
>>
>> static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
>>
>
--
Thanks,
David / dhildenb
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, (continued)
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Igor Mammedov, 2018/06/08
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Cornelia Huck, 2018/06/08
- Re: [Qemu-ppc] [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [Qemu-ppc] [PATCH v1 2/8] spapr: no need to verify the node, David Gibson, 2018/06/08
- Re: [Qemu-ppc] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
[Qemu-ppc] [PATCH v1 1/8] pc: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07
[Qemu-ppc] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug, David Hildenbrand, 2018/06/07
[Qemu-ppc] [PATCH v1 5/8] spapr: introduce machine unplug handler, David Hildenbrand, 2018/06/07
[Qemu-ppc] [PATCH v1 4/8] spapr: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07