hw/sd/ssi-sd: fix error handling in ssi_sd_realize
It's wrong to use same err object as errp parameter for several function calls without intermediate checking for error: we'll crash if try to set err object twice. Fix that. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200317125741.15301-1-vsementsov@virtuozzo.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
526ab8e863
commit
709dfb6492
@ -255,13 +255,25 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
|
||||
carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
|
||||
if (dinfo) {
|
||||
qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
|
||||
if (err) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
object_property_set_bool(OBJECT(carddev), true, "spi", &err);
|
||||
if (err) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
object_property_set_bool(OBJECT(carddev), true, "realized", &err);
|
||||
if (err) {
|
||||
error_setg(errp, "failed to init SD card: %s", error_get_pretty(err));
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
error_propagate_prepend(errp, err, "failed to init SD card: ");
|
||||
}
|
||||
|
||||
static void ssi_sd_reset(DeviceState *dev)
|
||||
|
Loading…
Reference in New Issue
Block a user