[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-next] pc: Ensure non-zero CPU ref count afte
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH for-next] pc: Ensure non-zero CPU ref count after attaching to ICC bus |
Date: |
Tue, 17 Mar 2015 18:09:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
Am 17.03.2015 um 18:04 schrieb Eduardo Habkost:
> On Tue, Mar 17, 2015 at 05:46:36PM +0100, Andreas Färber wrote:
> [...]
>> @@ -1054,7 +1055,12 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
>>
>> icc_bridge = DEVICE(object_resolve_path_type("icc-bridge",
>> TYPE_ICC_BRIDGE, NULL));
>> - pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
>> + cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, &local_err);
>> + if (local_err) {
>> + error_propagate(errp, local_err);
>> + return;
>> + }
>> + object_unref(OBJECT(cpu));
>
> Calling object_unref(NULL) is valid, so you can still keep it simple and
> do this:
>
> - pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
> + cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
> + object_unref(OBJECT(cpu));
Valid yes, but I have a follow-up doing:
error_propagate(errp, local_err);
return;
}
+ object_property_set_bool(OBJECT(cpu), true, "realized", errp);
object_unref(OBJECT(cpu));
}
So it's handier to keep it last.
Regards,
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)
[Qemu-devel] [PATCH for-next] pc: Ensure non-zero CPU ref count after attaching to ICC bus, Andreas Färber, 2015/03/17