Skip to content

Commit 5c24334

Browse files
zhijianli88mstsirkin
authored andcommitted
nvdimm: release the correct device list
Signed-off-by: Li Zhijian <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Igor Mammedov <[email protected]>
1 parent 243a928 commit 5c24334

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hw/acpi/nvdimm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ nvdimm_build_structure_caps(GArray *structures, uint32_t capabilities)
339339

340340
static GArray *nvdimm_build_device_structure(NVDIMMState *state)
341341
{
342-
GSList *device_list = nvdimm_get_device_list();
342+
GSList *device_list, *list = nvdimm_get_device_list();
343343
GArray *structures = g_array_new(false, true /* clear */, 1);
344344

345-
for (; device_list; device_list = device_list->next) {
345+
for (device_list = list; device_list; device_list = device_list->next) {
346346
DeviceState *dev = device_list->data;
347347

348348
/* build System Physical Address Range Structure. */
@@ -357,7 +357,7 @@ static GArray *nvdimm_build_device_structure(NVDIMMState *state)
357357
/* build NVDIMM Control Region Structure. */
358358
nvdimm_build_structure_dcr(structures, dev);
359359
}
360-
g_slist_free(device_list);
360+
g_slist_free(list);
361361

362362
if (state->persistence) {
363363
nvdimm_build_structure_caps(structures, state->persistence);
@@ -1333,9 +1333,9 @@ static void nvdimm_build_ssdt(GArray *table_offsets, GArray *table_data,
13331333

13341334
void nvdimm_build_srat(GArray *table_data)
13351335
{
1336-
GSList *device_list = nvdimm_get_device_list();
1336+
GSList *device_list, *list = nvdimm_get_device_list();
13371337

1338-
for (; device_list; device_list = device_list->next) {
1338+
for (device_list = list; device_list; device_list = device_list->next) {
13391339
DeviceState *dev = device_list->data;
13401340
Object *obj = OBJECT(dev);
13411341
uint64_t addr, size;
@@ -1348,7 +1348,7 @@ void nvdimm_build_srat(GArray *table_data)
13481348
build_srat_memory(table_data, addr, size, node,
13491349
MEM_AFFINITY_ENABLED | MEM_AFFINITY_NON_VOLATILE);
13501350
}
1351-
g_slist_free(device_list);
1351+
g_slist_free(list);
13521352
}
13531353

13541354
void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,

0 commit comments

Comments
 (0)