Skip to content

Commit

Permalink
hw/arm/aspeed: Check 'memory' link is set in common aspeed_soc_realize
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
philmd authored and legoater committed Oct 25, 2023
1 parent 1a94fae commit 24a8847
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hw/arm/aspeed_soc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
sysbus_mmio_get_region(dev, 0), -1000);
}

static void aspeed_soc_realize(DeviceState *dev, Error **errp)
{
AspeedSoCState *s = ASPEED_SOC(dev);

if (!s->memory) {
error_setg(errp, "'memory' link is not set");
return;
}
}

static Property aspeed_soc_properties[] = {
DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
MemoryRegion *),
Expand All @@ -126,6 +136,7 @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);

dc->realize = aspeed_soc_realize;
device_class_set_props(dc, aspeed_soc_properties);
}

Expand Down

0 comments on commit 24a8847

Please sign in to comment.