aboutsummaryrefslogtreecommitdiff
path: root/hw/sd
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-22 11:42:27 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-23 16:07:21 +0200
commit953cd66139b6e28fdc7cdbf28065a0a98ce7877c (patch)
tree48171649e2f7009f06b99c57c3a914f348865a56 /hw/sd
parent17d26ac61ee637a38d58b7053fdd1695ea2b7bc9 (diff)
sd/milkymist-memcard: Fix error API violation
The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. milkymist_memcard_realize() is wrong that way: it passes &err to qdev_prop_set_drive_err() and qdev_realize_and_unref(). Currently harmless, because the latter uses it only as first argument of error_propagate(). Making qdev_prop_set_drive_err() fail involves abuse of -global. Leave handling that to qdev_prop_set_drive(), like we do elsewhere. Cc: Michael Walle <michael@walle.cc> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200622094227.1271650-17-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/sd')
-rw-r--r--hw/sd/milkymist-memcard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index 1c23310715..482e97191e 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -279,7 +279,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
dinfo = drive_get_next(IF_SD);
blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
carddev = qdev_new(TYPE_SD_CARD);
- qdev_prop_set_drive_err(carddev, "drive", blk, &err);
+ qdev_prop_set_drive(carddev, "drive", blk);
qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err);
if (err) {
error_setg(errp, "failed to init SD card: %s", error_get_pretty(err));