aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorZhao Liu <zhao1.liu@intel.com>2024-02-23 16:56:53 +0800
committerMichael S. Tsirkin <mst@redhat.com>2024-03-12 17:56:55 -0400
commit0f9c30350bdf9d062609a15124f30f6c2b0a4b60 (patch)
tree3bb1fa48d3fde19806b550f05a697e4786a5c050 /hw/intc
parentccd1fd0c5d4f4cba7fa8642ab466a82db3e9f093 (diff)
downloadqemu-0f9c30350bdf9d062609a15124f30f6c2b0a4b60.zip
qemu-0f9c30350bdf9d062609a15124f30f6c2b0a4b60.tar.gz
qemu-0f9c30350bdf9d062609a15124f30f6c2b0a4b60.tar.bz2
hw/intc: Check @errp to handle the error of IOAPICCommonClass.realize()
IOAPICCommonClass implements its own private realize(), and this private realize() allows error. Since IOAPICCommonClass.realize() returns void, to check the error, dereference @errp with ERRP_GUARD(). Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Message-Id: <20240223085653.1255438-8-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/ioapic_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c
index cb9bf62..efbe695 100644
--- a/hw/intc/ioapic_common.c
+++ b/hw/intc/ioapic_common.c
@@ -152,6 +152,7 @@ static int ioapic_dispatch_post_load(void *opaque, int version_id)
static void ioapic_common_realize(DeviceState *dev, Error **errp)
{
+ ERRP_GUARD();
IOAPICCommonState *s = IOAPIC_COMMON(dev);
IOAPICCommonClass *info;
@@ -162,6 +163,9 @@ static void ioapic_common_realize(DeviceState *dev, Error **errp)
info = IOAPIC_COMMON_GET_CLASS(s);
info->realize(dev, errp);
+ if (*errp) {
+ return;
+ }
sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->io_memory);
ioapic_no++;