Error reporting patches for 2020-03-17
The following changes since commit 40c67636f67c2a89745f2e698522fe917326a952:
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200317-pull-request' into staging (2020-03-17 14:00:56 +0000)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.git tags/pull-error-2020-03-17
for you to fetch changes up to 709dfb64925ed2b2978bf4c17ab98b2c7a9a05c1:
hw/sd/ssi-sd: fix error handling in ssi_sd_realize (2020-03-17 17:30:03 +0100)
----------------------------------------------------------------
Error reporting patches for 2020-03-17
----------------------------------------------------------------
Markus Armbruster (3):
Use &error_abort instead of separate assert() hw/misc/ivshmem: Use one Error * variable instead of two
xen-block: Use one Error * variable instead of two
Vladimir Sementsov-Ogievskiy (1):
hw/sd/ssi-sd: fix error handling in ssi_sd_realize
block/monitor/block-hmp-cmds.c | 4 +--- hw/block/xen-block.c | 10 ++++------ hw/misc/ivshmem.c | 7 +++---- hw/sd/ssi-sd.c | 16 ++++++++++++++-- target/arm/monitor.c | 8 ++------ tests/qtest/fuzz/qos_fuzz.c | 7 ++----- 6 files changed, 26 insertions(+), 26 deletions(-)
Signature · 1 line
2.21.1
[PULL 1/4] Use &error_abort instead of separate assert()
Message-Id: <[email protected]>
--- block/monitor/block-hmp-cmds.c | 4 +--- target/arm/monitor.c | 8 ++------ tests/qtest/fuzz/qos_fuzz.c | 7 ++----- 3 files changed, 5 insertions(+), 14 deletions(-)
block/monitor/block-hmp-cmds.c +1 -3
@@ -838,10 +838,8 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdict)void hmp_info_block_jobs (Monitor *mon,const QDict *qdict) {BlockJobInfoList *list; -Error *err =NULL ; - list =qmp_query_block_jobs (&err); -assert (!err); + list =qmp_query_block_jobs (&error_abort);if (!list) {monitor_printf (mon,"No active jobs\n" );
target/arm/monitor.c +2 -6
@@ -206,9 +206,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,return NULL ; } }else { -Error *err =NULL ; -arm_cpu_finalize_features (ARM_CPU (obj), &err); -assert (err ==NULL ); +arm_cpu_finalize_features (ARM_CPU (obj), &error_abort); } expansion_info =g_new0 (CpuModelExpansionInfo,1 );
@@ -221,12 +219,10 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,while ((name = cpu_model_advertised_features[i++]) !=NULL ) {ObjectProperty *prop =object_property_find (obj, name,NULL );if (prop) { -Error *err =NULL ;QObject *value;assert (prop->get); - value =object_property_get_qobject (obj, name, &err); -assert (!err); + value =object_property_get_qobject (obj, name, &error_abort);qdict_put_obj (qdict_out, name, value); }
tests/qtest/fuzz/qos_fuzz.c +2 -5
@@ -55,10 +55,8 @@ static void qos_set_machines_devices_available(void)QObject *response;QDict *args =qdict_new ();QList *lst; -Error *err =NULL ; -qmp_marshal_query_machines (NULL , &response, &err); -assert (!err); +qmp_marshal_query_machines (NULL , &response, &error_abort); lst =qobject_to (QList, response);apply_to_qlist (lst, true);
@@ -70,8 +68,7 @@ static void qos_set_machines_devices_available(void)qdict_put_bool (args,"abstract" , true);qdict_put_obj (req,"arguments" , (QObject *) args); -qmp_marshal_qom_list_types (args, &response, &err); -assert (!err); +qmp_marshal_qom_list_types (args, &response, &error_abort); lst =qobject_to (QList, response);apply_to_qlist (lst, false);qobject_unref (response);
Signature · 1 line
2.21.1
[PULL 3/4] xen-block: Use one Error * variable instead of two
In reply to Markus ArmbrusterWhile there, tidy up indentation, and add return just for consistency and robustness.
Message-Id: <[email protected]>
--- hw/block/xen-block.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
hw/block/xen-block.c +4 -6
@@ -998,29 +998,27 @@ static void xen_block_device_destroy(XenBackendInstance *backend,XenBlockVdev *vdev = &blockdev->props.vdev;XenBlockDrive *drive = blockdev->drive;XenBlockIOThread *iothread = blockdev->iothread; +Error *local_err =NULL ;trace_xen_block_device_destroy (vdev->number);object_unparent (OBJECT (xendev));if (iothread) { -Error *local_err =NULL ; -xen_block_iothread_destroy (iothread, &local_err);if (local_err) {error_propagate_prepend (errp, local_err, -"failed to destroy iothread: " ); +"failed to destroy iothread: " );return ; } }if (drive) { -Error *local_err =NULL ; -xen_block_drive_destroy (drive, &local_err);if (local_err) {error_propagate_prepend (errp, local_err, -"failed to destroy drive: " ); +"failed to destroy drive: " ); +return ; } } }
Signature · 1 line
2.21.1
[PULL 2/4] hw/misc/ivshmem: Use one Error * variable instead of two
In reply to Markus ArmbrusterCommit fe44dc9180 "migration: disallow migrate_add_blocker during migration" accidentally added a second Error * variable. Use the first one instead.
Message-Id: <[email protected]>
--- hw/misc/ivshmem.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/misc/ivshmem.c +3 -4
@@ -832,7 +832,6 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)IVShmemState *s =IVSHMEM_COMMON (dev);Error *err =NULL ;uint8_t *pci_conf; -Error *local_err =NULL ;/* IRQFD requires MSI */ if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD) &&
@@ -899,9 +898,9 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)if (!ivshmem_is_master (s)) {error_setg (&s->migration_blocker,"Migration is disabled when using feature 'peer mode' in device 'ivshmem'" ); -migrate_add_blocker (s->migration_blocker, &local_err); -if (local_err) { -error_propagate (errp, local_err); +migrate_add_blocker (s->migration_blocker, &err); +if (err) { +error_propagate (errp, err);error_free (s->migration_blocker);return ; }
Signature · 1 line
2.21.1
[PULL 4/4] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
In reply to Markus ArmbrusterFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
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.
Message-Id: <[email protected]>
--- hw/sd/ssi-sd.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
hw/sd/ssi-sd.c +14 -2
@@ -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)
Signature · 1 line
2.21.1
Peter Maydell
AppliedQuoted 16 lines · Markus Armbruster
The following changes since commit
40c67636f67c2a89745f2e698522fe917326a952:Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200317-pull-request' into staging (2020-03-17 14:00:56 +0000)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.gittags/pull-error-2020-03-17for you to fetch changes up to
709dfb64925ed2b2978bf4c17ab98b2c7a9a05c1:hw/sd/ssi-sd: fix error handling in
ssi_sd_realize(2020-03-17 17:30:03 +0100)----------------------------------------------------------------
Error reporting patches for 2020-03-17
Quoted 9 lines
----------------------------------------------------------------
Markus Armbruster (3):
Use&error_abortinstead of separateassert()hw/misc/ivshmem: Use one Error * variable instead of two
xen-block: Use one Error * variable instead of twoVladimir Sementsov-Ogievskiy (1):
hw/sd/ssi-sd: fix error handling inssi_sd_realize
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.
-- PMM