qom: Don't handle impossible object_property_get_link() failure
Don't handle object_property_get_link() failure that can't happen unless the programmer screwed up, pass &error_abort. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200707160613.848843-25-armbru@redhat.com>
This commit is contained in:
parent
552d7f49ee
commit
4d21fcd524
@ -134,12 +134,7 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
|
|||||||
uint64_t ram_size, vcram_size;
|
uint64_t ram_size, vcram_size;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "ram", &err);
|
obj = object_property_get_link(OBJECT(dev), "ram", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required ram link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ram = MEMORY_REGION(obj);
|
ram = MEMORY_REGION(obj);
|
||||||
ram_size = memory_region_size(ram);
|
ram_size = memory_region_size(ram);
|
||||||
|
@ -77,12 +77,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
|
|||||||
|
|
||||||
/* common peripherals from bcm2835 */
|
/* common peripherals from bcm2835 */
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "ram", &err);
|
obj = object_property_get_link(OBJECT(dev), "ram", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required ram link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
object_property_add_const_link(OBJECT(&s->peripherals), "ram", obj);
|
object_property_add_const_link(OBJECT(&s->peripherals), "ram", obj);
|
||||||
|
|
||||||
|
@ -405,7 +405,6 @@ static void bcm2835_fb_reset(DeviceState *dev)
|
|||||||
static void bcm2835_fb_realize(DeviceState *dev, Error **errp)
|
static void bcm2835_fb_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
BCM2835FBState *s = BCM2835_FB(dev);
|
BCM2835FBState *s = BCM2835_FB(dev);
|
||||||
Error *err = NULL;
|
|
||||||
Object *obj;
|
Object *obj;
|
||||||
|
|
||||||
if (s->vcram_base == 0) {
|
if (s->vcram_base == 0) {
|
||||||
@ -413,12 +412,7 @@ static void bcm2835_fb_realize(DeviceState *dev, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "dma-mr", &err);
|
obj = object_property_get_link(OBJECT(dev), "dma-mr", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required dma-mr link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill in the parts of initial_config that are not set by QOM properties */
|
/* Fill in the parts of initial_config that are not set by QOM properties */
|
||||||
s->initial_config.xres_virtual = s->initial_config.xres;
|
s->initial_config.xres_virtual = s->initial_config.xres;
|
||||||
|
@ -376,16 +376,9 @@ static void bcm2835_dma_reset(DeviceState *dev)
|
|||||||
static void bcm2835_dma_realize(DeviceState *dev, Error **errp)
|
static void bcm2835_dma_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
BCM2835DMAState *s = BCM2835_DMA(dev);
|
BCM2835DMAState *s = BCM2835_DMA(dev);
|
||||||
Error *err = NULL;
|
|
||||||
Object *obj;
|
Object *obj;
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "dma-mr", &err);
|
obj = object_property_get_link(OBJECT(dev), "dma-mr", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required dma-mr link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->dma_mr = MEMORY_REGION(obj);
|
s->dma_mr = MEMORY_REGION(obj);
|
||||||
address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_DMA "-memory");
|
address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_DMA "-memory");
|
||||||
|
|
||||||
|
@ -312,22 +312,11 @@ static void bcm2835_gpio_realize(DeviceState *dev, Error **errp)
|
|||||||
{
|
{
|
||||||
BCM2835GpioState *s = BCM2835_GPIO(dev);
|
BCM2835GpioState *s = BCM2835_GPIO(dev);
|
||||||
Object *obj;
|
Object *obj;
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "sdbus-sdhci", &err);
|
obj = object_property_get_link(OBJECT(dev), "sdbus-sdhci", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required sdhci link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
s->sdbus_sdhci = SD_BUS(obj);
|
s->sdbus_sdhci = SD_BUS(obj);
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "sdbus-sdhost", &err);
|
obj = object_property_get_link(OBJECT(dev), "sdbus-sdhost", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required sdhost link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
s->sdbus_sdhost = SD_BUS(obj);
|
s->sdbus_sdhost = SD_BUS(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,14 +66,8 @@ static void altera_iic_init(Object *obj)
|
|||||||
static void altera_iic_realize(DeviceState *dev, Error **errp)
|
static void altera_iic_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
struct AlteraIIC *pv = ALTERA_IIC(dev);
|
struct AlteraIIC *pv = ALTERA_IIC(dev);
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
pv->cpu = object_property_get_link(OBJECT(dev), "cpu", &err);
|
pv->cpu = object_property_get_link(OBJECT(dev), "cpu", &error_abort);
|
||||||
if (!pv->cpu) {
|
|
||||||
error_setg(errp, "altera,iic: CPU link not found: %s",
|
|
||||||
error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void altera_iic_class_init(ObjectClass *klass, void *data)
|
static void altera_iic_class_init(ObjectClass *klass, void *data)
|
||||||
|
@ -308,15 +308,8 @@ static void bcm2835_mbox_realize(DeviceState *dev, Error **errp)
|
|||||||
{
|
{
|
||||||
BCM2835MboxState *s = BCM2835_MBOX(dev);
|
BCM2835MboxState *s = BCM2835_MBOX(dev);
|
||||||
Object *obj;
|
Object *obj;
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "mbox-mr", &err);
|
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required mbox-mr link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
obj = object_property_get_link(OBJECT(dev), "mbox-mr", &error_abort);
|
||||||
s->mbox_mr = MEMORY_REGION(obj);
|
s->mbox_mr = MEMORY_REGION(obj);
|
||||||
address_space_init(&s->mbox_as, s->mbox_mr, TYPE_BCM2835_MBOX "-memory");
|
address_space_init(&s->mbox_as, s->mbox_mr, TYPE_BCM2835_MBOX "-memory");
|
||||||
bcm2835_mbox_reset(dev);
|
bcm2835_mbox_reset(dev);
|
||||||
|
@ -392,24 +392,11 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp)
|
|||||||
{
|
{
|
||||||
BCM2835PropertyState *s = BCM2835_PROPERTY(dev);
|
BCM2835PropertyState *s = BCM2835_PROPERTY(dev);
|
||||||
Object *obj;
|
Object *obj;
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "fb", &err);
|
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required fb link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
obj = object_property_get_link(OBJECT(dev), "fb", &error_abort);
|
||||||
s->fbdev = BCM2835_FB(obj);
|
s->fbdev = BCM2835_FB(obj);
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "dma-mr", &err);
|
obj = object_property_get_link(OBJECT(dev), "dma-mr", &error_abort);
|
||||||
if (obj == NULL) {
|
|
||||||
error_setg(errp, "%s: required dma-mr link not found: %s",
|
|
||||||
__func__, error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->dma_mr = MEMORY_REGION(obj);
|
s->dma_mr = MEMORY_REGION(obj);
|
||||||
address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_PROPERTY "-memory");
|
address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_PROPERTY "-memory");
|
||||||
|
|
||||||
|
@ -1274,15 +1274,8 @@ static void dwc2_realize(DeviceState *dev, Error **errp)
|
|||||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||||
DWC2State *s = DWC2_USB(dev);
|
DWC2State *s = DWC2_USB(dev);
|
||||||
Object *obj;
|
Object *obj;
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
obj = object_property_get_link(OBJECT(dev), "dma-mr", &err);
|
obj = object_property_get_link(OBJECT(dev), "dma-mr", &error_abort);
|
||||||
if (err) {
|
|
||||||
error_setg(errp, "dwc2: required dma-mr link not found: %s",
|
|
||||||
error_get_pretty(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert(obj != NULL);
|
|
||||||
|
|
||||||
s->dma_mr = MEMORY_REGION(obj);
|
s->dma_mr = MEMORY_REGION(obj);
|
||||||
address_space_init(&s->dma_as, s->dma_mr, "dwc2");
|
address_space_init(&s->dma_as, s->dma_mr, "dwc2");
|
||||||
|
Loading…
Reference in New Issue
Block a user