65 lines
2.0 KiB
Diff
65 lines
2.0 KiB
Diff
|
|
From aec47cbfa3ad713883d783cd86d3d6fe3413a585 Mon Sep 17 00:00:00 2001
|
||
|
|
From: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Mon, 4 Mar 2024 01:26:37 -0800
|
||
|
|
Subject: [PATCH] hw/nvram/xlnx-efuse: Free XlnxEFuse::ro_bits[] array on
|
||
|
|
finalize()
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
Commit 0be6bfac62 ("qdev: Implement variable length array properties")
|
||
|
|
added the DEFINE_PROP_ARRAY() macro with the following comment:
|
||
|
|
|
||
|
|
* It is the responsibility of the device deinit code to free the
|
||
|
|
* @_arrayfield memory.
|
||
|
|
|
||
|
|
Commit 68fbcc344e added:
|
||
|
|
|
||
|
|
DEFINE_PROP_ARRAY("read-only", XlnxEFuse, ro_bits_cnt, ro_bits,
|
||
|
|
qdev_prop_uint32, uint32_t),
|
||
|
|
|
||
|
|
but forgot to free the 'ro_bits' array. Do it in the instance_finalize
|
||
|
|
handler.
|
||
|
|
|
||
|
|
Cc: qemu-stable@nongnu.org
|
||
|
|
Fixes: 68fbcc344e ("hw/nvram: Introduce Xilinx eFuse QOM") # v6.2.0+
|
||
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||
|
|
Message-id: 20231121174051.63038-5-philmd@linaro.org
|
||
|
|
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
(cherry picked from commit 49b3e28b7bdfe771150d05c4b5860aa7854a4232)
|
||
|
|
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
hw/nvram/xlnx-efuse.c | 8 ++++++++
|
||
|
|
1 file changed, 8 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
|
||
|
|
index a0fd77b586..5b131e89b1 100644
|
||
|
|
--- a/hw/nvram/xlnx-efuse.c
|
||
|
|
+++ b/hw/nvram/xlnx-efuse.c
|
||
|
|
@@ -217,6 +217,13 @@ static void efuse_realize(DeviceState *dev, Error **errp)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
+static void efuse_finalize(Object *obj)
|
||
|
|
+{
|
||
|
|
+ XlnxEFuse *s = XLNX_EFUSE(obj);
|
||
|
|
+
|
||
|
|
+ g_free(s->ro_bits);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
static void efuse_prop_set_drive(Object *obj, Visitor *v, const char *name,
|
||
|
|
void *opaque, Error **errp)
|
||
|
|
{
|
||
|
|
@@ -273,6 +280,7 @@ static const TypeInfo efuse_info = {
|
||
|
|
.name = TYPE_XLNX_EFUSE,
|
||
|
|
.parent = TYPE_DEVICE,
|
||
|
|
.instance_size = sizeof(XlnxEFuse),
|
||
|
|
+ .instance_finalize = efuse_finalize,
|
||
|
|
.class_init = efuse_class_init,
|
||
|
|
};
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|