diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-06-22 11:42:27 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-06-23 16:07:21 +0200 |
commit | 953cd66139b6e28fdc7cdbf28065a0a98ce7877c (patch) | |
tree | 48171649e2f7009f06b99c57c3a914f348865a56 /hw/sd | |
parent | 17d26ac61ee637a38d58b7053fdd1695ea2b7bc9 (diff) | |
download | qemu-953cd66139b6e28fdc7cdbf28065a0a98ce7877c.zip qemu-953cd66139b6e28fdc7cdbf28065a0a98ce7877c.tar.gz qemu-953cd66139b6e28fdc7cdbf28065a0a98ce7877c.tar.bz2 |
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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 1c23310..482e971 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)); |