aboutsummaryrefslogtreecommitdiff
path: root/hw/sd/ssi-sd.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/sd/ssi-sd.c')
-rw-r--r--hw/sd/ssi-sd.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 25cdf4c966..9210ef567f 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -241,10 +241,10 @@ static const VMStateDescription vmstate_ssi_sd = {
static void ssi_sd_realize(SSISlave *d, Error **errp)
{
+ ERRP_GUARD();
ssi_sd_state *s = SSI_SD(d);
DeviceState *carddev;
DriveInfo *dinfo;
- Error *err = NULL;
qbus_create_inplace(&s->sdbus, sizeof(s->sdbus), TYPE_SD_BUS,
DEVICE(d), "sd-bus");
@@ -254,27 +254,24 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
dinfo = drive_get_next(IF_SD);
carddev = qdev_new(TYPE_SD_CARD);
if (dinfo) {
- qdev_prop_set_drive_err(carddev, "drive", blk_by_legacy_dinfo(dinfo),
- &err);
- if (err) {
+ if (!qdev_prop_set_drive_err(carddev, "drive",
+ blk_by_legacy_dinfo(dinfo), errp)) {
goto fail;
}
}
- object_property_set_bool(OBJECT(carddev), true, "spi", &err);
- if (err) {
+ if (!object_property_set_bool(OBJECT(carddev), "spi", true, errp)) {
goto fail;
}
- qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err);
- if (err) {
+ if (!qdev_realize_and_unref(carddev, BUS(&s->sdbus), errp)) {
goto fail;
}
return;
fail:
- error_propagate_prepend(errp, err, "failed to init SD card: ");
+ error_prepend(errp, "failed to init SD card: ");
}
static void ssi_sd_reset(DeviceState *dev)