[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/18] spapr: Use appropriate getter for PC_DIMM_SLOT_PROP
From: |
David Gibson |
Subject: |
[PULL 12/18] spapr: Use appropriate getter for PC_DIMM_SLOT_PROP |
Date: |
Wed, 28 Oct 2020 01:17:29 +1100 |
From: Greg Kurz <groug@kaod.org>
The PC_DIMM_SLOT_PROP property is defined as:
DEFINE_PROP_INT32(PC_DIMM_SLOT_PROP, PCDIMMDevice, slot,
PC_DIMM_UNASSIGNED_SLOT),
Use object_property_get_int() instead of object_property_get_uint().
Since spapr_memory_plug() only gets called if pc_dimm_pre_plug()
succeeded, we expect to have a valid >= 0 slot number, either because
the user passed a valid slot number or because pc_dimm_get_free_slot()
picked one up for us.
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160309730758.2739814.15821922745424652642.stgit@bahia.lan>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/ppc/spapr.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b2405599ad..f8856ccf27 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3433,7 +3433,8 @@ static void spapr_memory_plug(HotplugHandler
*hotplug_dev, DeviceState *dev,
Error *local_err = NULL;
SpaprMachineState *ms = SPAPR_MACHINE(hotplug_dev);
PCDIMMDevice *dimm = PC_DIMM(dev);
- uint64_t size, addr, slot;
+ uint64_t size, addr;
+ int64_t slot;
bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
size = memory_device_get_region_size(MEMORY_DEVICE(dev), &error_abort);
@@ -3450,11 +3451,13 @@ static void spapr_memory_plug(HotplugHandler
*hotplug_dev, DeviceState *dev,
spapr_ovec_test(ms->ov5_cas, OV5_HP_EVT),
&local_err);
} else {
- slot = object_property_get_uint(OBJECT(dimm),
- PC_DIMM_SLOT_PROP, &local_err);
+ slot = object_property_get_int(OBJECT(dimm),
+ PC_DIMM_SLOT_PROP, &local_err);
if (local_err) {
goto out_unplug;
}
+ /* We should have valid slot number at this point */
+ g_assert(slot >= 0);
spapr_add_nvdimm(dev, slot, &local_err);
}
--
2.26.2
- [PULL 02/18] ppc/spapr: re-assert IRQs during event-scan if there are pending, (continued)
- [PULL 02/18] ppc/spapr: re-assert IRQs during event-scan if there are pending, David Gibson, 2020/10/27
- [PULL 04/18] spapr: Move spapr_create_nvdimm_dr_connectors() to core machine code, David Gibson, 2020/10/27
- [PULL 03/18] hw/net: move allocation to the heap due to very large stack frame, David Gibson, 2020/10/27
- [PULL 06/18] spapr: Unrealize vCPUs with qdev_unrealize(), David Gibson, 2020/10/27
- [PULL 08/18] spapr: Make spapr_cpu_core_unrealize() idempotent, David Gibson, 2020/10/27
- [PULL 07/18] spapr: Drop spapr_delete_vcpu() unused argument, David Gibson, 2020/10/27
- [PULL 13/18] spapr: Pass &error_abort when getting some PC DIMM properties, David Gibson, 2020/10/27
- [PULL 05/18] spapr: Fix leak of CPU machine specific data, David Gibson, 2020/10/27
- [PULL 11/18] spapr: Use appropriate getter for PC_DIMM_ADDR_PROP, David Gibson, 2020/10/27
- [PULL 09/18] spapr: Simplify spapr_cpu_core_realize() and spapr_cpu_core_unrealize(), David Gibson, 2020/10/27
- [PULL 12/18] spapr: Use appropriate getter for PC_DIMM_SLOT_PROP,
David Gibson <=
- [PULL 10/18] pc-dimm: Drop @errp argument of pc_dimm_plug(), David Gibson, 2020/10/27
- [PULL 15/18] spapr: Use error_append_hint() in spapr_reallocate_hpt(), David Gibson, 2020/10/27
- [PULL 16/18] target/ppc: Fix kvmppc_load_htab_chunk() error reporting, David Gibson, 2020/10/27
- [PULL 14/18] spapr: Simplify error handling in spapr_memory_plug(), David Gibson, 2020/10/27
- [PULL 18/18] ppc/: fix some comment spelling errors, David Gibson, 2020/10/27
- [PULL 17/18] spapr: Improve spapr_reallocate_hpt() error reporting, David Gibson, 2020/10/27
- Re: [PULL 00/18] ppc-for-5.2 queue 20201028, Peter Maydell, 2020/10/30