@@ -277,8 +277,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
if (serial && object_property_find(OBJECT(dev), "serial", NULL)) {
qdev_prop_set_string(dev, "serial", serial);
}
- qdev_prop_set_drive_err(dev, "drive", blk, &err);
- if (err) {
+ if (!qdev_prop_set_drive_err(dev, "drive", blk, &err)) {
error_propagate(errp, err);
object_unparent(OBJECT(dev));
return NULL;
@@ -706,8 +706,7 @@ SDState *sd_init(BlockBackend *blk, bool is_spi)
obj = object_new(TYPE_SD_CARD);
dev = DEVICE(obj);
- qdev_prop_set_drive_err(dev, "drive", blk, &err);
- if (err) {
+ if (!qdev_prop_set_drive_err(dev, "drive", blk, &err)) {
error_reportf_err(err, "sd_init failed: ");
return NULL;
}
@@ -254,9 +254,8 @@ 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), &err)) {
goto fail;
}
}