* [PATCH 1/3] Use &error_abort instead of separate assert()
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
@ 2020-03-13 17:05 ` Markus Armbruster
2020-03-13 17:37 ` Alexander Bulekov
2020-03-13 17:05 ` [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two Markus Armbruster
` (4 subsequent siblings)
5 siblings, 1 reply; 21+ messages in thread
From: Markus Armbruster @ 2020-03-13 17:05 UTC (permalink / raw)
To: qemu-devel; +Cc: alxndr, vsementsov, ashijeetacharya, qemu-block, paul.durrant
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block/monitor/block-hmp-cmds.c | 4 +---
target/arm/monitor.c | 8 ++------
tests/qtest/fuzz/qos_fuzz.c | 6 ++----
3 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index c3a6368dfc..4c8c375172 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -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");
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index c2dc7908de..ea6598c412 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -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);
}
diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c
index 1a99277d60..aa9eee6ebf 100644
--- a/tests/qtest/fuzz/qos_fuzz.c
+++ b/tests/qtest/fuzz/qos_fuzz.c
@@ -57,8 +57,7 @@ static void qos_set_machines_devices_available(void)
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 +69,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);
--
2.21.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] Use &error_abort instead of separate assert()
2020-03-13 17:05 ` [PATCH 1/3] Use &error_abort instead of separate assert() Markus Armbruster
@ 2020-03-13 17:37 ` Alexander Bulekov
2020-03-13 17:57 ` Eric Blake
2020-03-14 4:58 ` Markus Armbruster
0 siblings, 2 replies; 21+ messages in thread
From: Alexander Bulekov @ 2020-03-13 17:37 UTC (permalink / raw)
To: Markus Armbruster
Cc: ashijeetacharya, vsementsov, qemu-devel, qemu-block, paul.durrant
On 200313 1805, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> index 1a99277d60..aa9eee6ebf 100644
> --- a/tests/qtest/fuzz/qos_fuzz.c
> +++ b/tests/qtest/fuzz/qos_fuzz.c
> @@ -57,8 +57,7 @@ static void qos_set_machines_devices_available(void)
> QList *lst;
> Error *err = NULL;
Can this err declaration be removed? Don't think it's used anywhere
else.
>
> - 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 +69,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);
> --
> 2.21.1
>
Thanks!
Acked-by: Alexander Bulekov <alxndr@bu.edu>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] Use &error_abort instead of separate assert()
2020-03-13 17:37 ` Alexander Bulekov
@ 2020-03-13 17:57 ` Eric Blake
2020-03-14 4:58 ` Markus Armbruster
1 sibling, 0 replies; 21+ messages in thread
From: Eric Blake @ 2020-03-13 17:57 UTC (permalink / raw)
To: Alexander Bulekov, Markus Armbruster
Cc: qemu-block, vsementsov, qemu-devel, ashijeetacharya, paul.durrant
On 3/13/20 12:37 PM, Alexander Bulekov wrote:
> On 200313 1805, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
>
>> index 1a99277d60..aa9eee6ebf 100644
>> --- a/tests/qtest/fuzz/qos_fuzz.c
>> +++ b/tests/qtest/fuzz/qos_fuzz.c
>> @@ -57,8 +57,7 @@ static void qos_set_machines_devices_available(void)
>> QList *lst;
>> Error *err = NULL;
> Can this err declaration be removed? Don't think it's used anywhere
> else.
Correct, it is not. With that additional line gone,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] Use &error_abort instead of separate assert()
2020-03-13 17:37 ` Alexander Bulekov
2020-03-13 17:57 ` Eric Blake
@ 2020-03-14 4:58 ` Markus Armbruster
2020-03-17 12:21 ` Vladimir Sementsov-Ogievskiy
1 sibling, 1 reply; 21+ messages in thread
From: Markus Armbruster @ 2020-03-14 4:58 UTC (permalink / raw)
To: Alexander Bulekov
Cc: qemu-block, vsementsov, qemu-devel, ashijeetacharya, paul.durrant
Alexander Bulekov <alxndr@bu.edu> writes:
> On 200313 1805, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
>
>> index 1a99277d60..aa9eee6ebf 100644
>> --- a/tests/qtest/fuzz/qos_fuzz.c
>> +++ b/tests/qtest/fuzz/qos_fuzz.c
>> @@ -57,8 +57,7 @@ static void qos_set_machines_devices_available(void)
>> QList *lst;
>> Error *err = NULL;
> Can this err declaration be removed? Don't think it's used anywhere
> else.
Will do.
>> - 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 +69,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);
>> --
>> 2.21.1
>>
> Thanks!
>
> Acked-by: Alexander Bulekov <alxndr@bu.edu>
Thanks!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] Use &error_abort instead of separate assert()
2020-03-14 4:58 ` Markus Armbruster
@ 2020-03-17 12:21 ` Vladimir Sementsov-Ogievskiy
0 siblings, 0 replies; 21+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-17 12:21 UTC (permalink / raw)
To: Markus Armbruster, Alexander Bulekov
Cc: qemu-block, qemu-devel, ashijeetacharya, paul.durrant
14.03.2020 7:58, Markus Armbruster wrote:
> Alexander Bulekov <alxndr@bu.edu> writes:
>
>> On 200313 1805, Markus Armbruster wrote:
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>
>>
>>> index 1a99277d60..aa9eee6ebf 100644
>>> --- a/tests/qtest/fuzz/qos_fuzz.c
>>> +++ b/tests/qtest/fuzz/qos_fuzz.c
>>> @@ -57,8 +57,7 @@ static void qos_set_machines_devices_available(void)
>>> QList *lst;
>>> Error *err = NULL;
>> Can this err declaration be removed? Don't think it's used anywhere
>> else.
>
> Will do.
with this:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
>>> - 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 +69,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);
>>> --
>>> 2.21.1
>>>
>> Thanks!
>>
>> Acked-by: Alexander Bulekov <alxndr@bu.edu>
>
> Thanks!
>
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
2020-03-13 17:05 ` [PATCH 1/3] Use &error_abort instead of separate assert() Markus Armbruster
@ 2020-03-13 17:05 ` Markus Armbruster
2020-03-13 17:58 ` Eric Blake
2020-03-17 12:27 ` Vladimir Sementsov-Ogievskiy
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
` (3 subsequent siblings)
5 siblings, 2 replies; 21+ messages in thread
From: Markus Armbruster @ 2020-03-13 17:05 UTC (permalink / raw)
To: qemu-devel; +Cc: alxndr, vsementsov, ashijeetacharya, qemu-block, paul.durrant
Commit fe44dc9180 "migration: disallow migrate_add_blocker during
migration" accidentally added a second Error * variable. Use the
first one instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/misc/ivshmem.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 1a0fad74e1..a8dc9b377d 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -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;
}
--
2.21.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two
2020-03-13 17:05 ` [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two Markus Armbruster
@ 2020-03-13 17:58 ` Eric Blake
2020-03-17 12:27 ` Vladimir Sementsov-Ogievskiy
1 sibling, 0 replies; 21+ messages in thread
From: Eric Blake @ 2020-03-13 17:58 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: alxndr, vsementsov, qemu-block, ashijeetacharya, paul.durrant
On 3/13/20 12:05 PM, Markus Armbruster wrote:
> Commit fe44dc9180 "migration: disallow migrate_add_blocker during
> migration" accidentally added a second Error * variable. Use the
> first one instead.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/misc/ivshmem.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two
2020-03-13 17:05 ` [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two Markus Armbruster
2020-03-13 17:58 ` Eric Blake
@ 2020-03-17 12:27 ` Vladimir Sementsov-Ogievskiy
1 sibling, 0 replies; 21+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-17 12:27 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: alxndr, paul.durrant, ashijeetacharya, qemu-block
13.03.2020 20:05, Markus Armbruster wrote:
> Commit fe44dc9180 "migration: disallow migrate_add_blocker during
> migration" accidentally added a second Error * variable. Use the
> first one instead.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/misc/ivshmem.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index 1a0fad74e1..a8dc9b377d 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -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'");
Hmm, if you want, you may fix this over-80 line while we are here.
> - 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;
> }
>
migrate_add_blocker returns error code, so we can just do
if (migrate_add_blocker(s->migration_blocker, errp)) {
error_free(s->migration_blocker;
return;
}
With or without this:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
2020-03-13 17:05 ` [PATCH 1/3] Use &error_abort instead of separate assert() Markus Armbruster
2020-03-13 17:05 ` [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two Markus Armbruster
@ 2020-03-13 17:05 ` Markus Armbruster
2020-03-13 18:01 ` Eric Blake
` (2 more replies)
2020-03-13 17:26 ` [PATCH 0/3] Minor error handling cleanups Peter Maydell
` (2 subsequent siblings)
5 siblings, 3 replies; 21+ messages in thread
From: Markus Armbruster @ 2020-03-13 17:05 UTC (permalink / raw)
To: qemu-devel; +Cc: alxndr, vsementsov, ashijeetacharya, qemu-block, paul.durrant
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/block/xen-block.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 3885464513..7b3b6dee97 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -998,14 +998,13 @@ 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,
@@ -1015,8 +1014,6 @@ static void xen_block_device_destroy(XenBackendInstance *backend,
}
if (drive) {
- Error *local_err = NULL;
-
xen_block_drive_destroy(drive, &local_err);
if (local_err) {
error_propagate_prepend(errp, local_err,
--
2.21.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
@ 2020-03-13 18:01 ` Eric Blake
2020-03-13 19:48 ` Philippe Mathieu-Daudé
2020-03-17 12:32 ` Vladimir Sementsov-Ogievskiy
2 siblings, 0 replies; 21+ messages in thread
From: Eric Blake @ 2020-03-13 18:01 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: alxndr, vsementsov, qemu-block, ashijeetacharya, paul.durrant
On 3/13/20 12:05 PM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/block/xen-block.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
2020-03-13 18:01 ` Eric Blake
@ 2020-03-13 19:48 ` Philippe Mathieu-Daudé
2020-03-17 12:32 ` Vladimir Sementsov-Ogievskiy
2 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-13 19:48 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: alxndr, vsementsov, qemu-block, ashijeetacharya, paul.durrant
On 3/13/20 6:05 PM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/block/xen-block.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> index 3885464513..7b3b6dee97 100644
> --- a/hw/block/xen-block.c
> +++ b/hw/block/xen-block.c
> @@ -998,14 +998,13 @@ 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,
> @@ -1015,8 +1014,6 @@ static void xen_block_device_destroy(XenBackendInstance *backend,
> }
>
> if (drive) {
> - Error *local_err = NULL;
> -
> xen_block_drive_destroy(drive, &local_err);
> if (local_err) {
> error_propagate_prepend(errp, local_err,
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
2020-03-13 18:01 ` Eric Blake
2020-03-13 19:48 ` Philippe Mathieu-Daudé
@ 2020-03-17 12:32 ` Vladimir Sementsov-Ogievskiy
2020-03-17 19:03 ` Markus Armbruster
2 siblings, 1 reply; 21+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-17 12:32 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: alxndr, paul.durrant, ashijeetacharya, qemu-block
13.03.2020 20:05, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/block/xen-block.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> index 3885464513..7b3b6dee97 100644
> --- a/hw/block/xen-block.c
> +++ b/hw/block/xen-block.c
> @@ -998,14 +998,13 @@ 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,
> @@ -1015,8 +1014,6 @@ static void xen_block_device_destroy(XenBackendInstance *backend,
> }
>
> if (drive) {
> - Error *local_err = NULL;
> -
> xen_block_drive_destroy(drive, &local_err);
> if (local_err) {
> error_propagate_prepend(errp, local_err,
Hmm, no "return;" statement after this propagation. It's OK, as there no more code in the function after this "if", but I'd add it to be consistent and to avoid forgetting to add a return here when add more code to the function.
(and if you do this, you may also fix indentation of string paramter of error_propagate_prepend...)
Anyway,
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-17 12:32 ` Vladimir Sementsov-Ogievskiy
@ 2020-03-17 19:03 ` Markus Armbruster
2020-03-17 20:04 ` Vladimir Sementsov-Ogievskiy
0 siblings, 1 reply; 21+ messages in thread
From: Markus Armbruster @ 2020-03-17 19:03 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy
Cc: alxndr, qemu-block, qemu-devel, ashijeetacharya
Uh, I failed to actually send this. It's in my pull request now.
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
> 13.03.2020 20:05, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> hw/block/xen-block.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
>> index 3885464513..7b3b6dee97 100644
>> --- a/hw/block/xen-block.c
>> +++ b/hw/block/xen-block.c
>> @@ -998,14 +998,13 @@ 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,
>> @@ -1015,8 +1014,6 @@ static void xen_block_device_destroy(XenBackendInstance *backend,
>> }
>> if (drive) {
>> - Error *local_err = NULL;
>> -
>> xen_block_drive_destroy(drive, &local_err);
>> if (local_err) {
>> error_propagate_prepend(errp, local_err,
>
> Hmm, no "return;" statement after this propagation. It's OK, as there no more code in the function after this "if", but I'd add it to be consistent and to avoid forgetting to add a return here when add more code to the function.
>
> (and if you do this, you may also fix indentation of string paramter of error_propagate_prepend...)
>
>
>
> Anyway,
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Like this, I guess:
xen-block: Use one Error * variable instead of two
While there, tidy up indentation, and add return just for consistency
and robustness.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200313170517.22480-4-armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 3885464513..07bb32e22b 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -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;
}
}
}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] xen-block: Use one Error * variable instead of two
2020-03-17 19:03 ` Markus Armbruster
@ 2020-03-17 20:04 ` Vladimir Sementsov-Ogievskiy
0 siblings, 0 replies; 21+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-17 20:04 UTC (permalink / raw)
To: Markus Armbruster; +Cc: alxndr, qemu-block, qemu-devel, ashijeetacharya
17.03.2020 22:03, Markus Armbruster wrote:
> Uh, I failed to actually send this. It's in my pull request now.
>
> Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
>
>> 13.03.2020 20:05, Markus Armbruster wrote:
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
>>> hw/block/xen-block.c | 5 +----
>>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
>>> index 3885464513..7b3b6dee97 100644
>>> --- a/hw/block/xen-block.c
>>> +++ b/hw/block/xen-block.c
>>> @@ -998,14 +998,13 @@ 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,
>>> @@ -1015,8 +1014,6 @@ static void xen_block_device_destroy(XenBackendInstance *backend,
>>> }
>>> if (drive) {
>>> - Error *local_err = NULL;
>>> -
>>> xen_block_drive_destroy(drive, &local_err);
>>> if (local_err) {
>>> error_propagate_prepend(errp, local_err,
>>
>> Hmm, no "return;" statement after this propagation. It's OK, as there no more code in the function after this "if", but I'd add it to be consistent and to avoid forgetting to add a return here when add more code to the function.
>>
>> (and if you do this, you may also fix indentation of string paramter of error_propagate_prepend...)
>>
>>
>>
>> Anyway,
>> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> Like this, I guess:
>
> xen-block: Use one Error * variable instead of two
>
> While there, tidy up indentation, and add return just for consistency
> and robustness.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Message-Id: <20200313170517.22480-4-armbru@redhat.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> index 3885464513..07bb32e22b 100644
> --- a/hw/block/xen-block.c
> +++ b/hw/block/xen-block.c
> @@ -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;
> }
> }
> }
>
Yes, that's what I meant, thanks!
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Minor error handling cleanups
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
` (2 preceding siblings ...)
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
@ 2020-03-13 17:26 ` Peter Maydell
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
2020-03-17 16:34 ` [PATCH 0/3] Minor error handling cleanups Markus Armbruster
5 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2020-03-13 17:26 UTC (permalink / raw)
To: Markus Armbruster
Cc: Vladimir Sementsov-Ogievskiy, Qemu-block, QEMU Developers,
Alexander Bulekov, Paul Durrant, Ashijeet Acharya
On Fri, 13 Mar 2020 at 17:06, Markus Armbruster <armbru@redhat.com> wrote:
>
> 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
>
> block/monitor/block-hmp-cmds.c | 4 +---
> hw/block/xen-block.c | 5 +----
> hw/misc/ivshmem.c | 7 +++----
> target/arm/monitor.c | 8 ++------
> tests/qtest/fuzz/qos_fuzz.c | 6 ++----
> 5 files changed, 9 insertions(+), 21 deletions(-)
series
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
` (3 preceding siblings ...)
2020-03-13 17:26 ` [PATCH 0/3] Minor error handling cleanups Peter Maydell
@ 2020-03-17 12:57 ` Vladimir Sementsov-Ogievskiy
2020-03-17 14:13 ` Philippe Mathieu-Daudé
` (2 more replies)
2020-03-17 16:34 ` [PATCH 0/3] Minor error handling cleanups Markus Armbruster
5 siblings, 3 replies; 21+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-17 12:57 UTC (permalink / raw)
To: qemu-devel
Cc: vsementsov, qemu-block, armbru, alxndr, paul.durrant,
ashijeetacharya, philmd
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.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
Forgive me for sending this into your series, but seems it is very
appropriate.
It's rephrasing of my
[PATCH v9 03/10] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
for partI series but but without use of ERRP_AUTO_PROPAGATE.
hw/sd/ssi-sd.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 91db069212..829797b597 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -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)
--
2.21.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
@ 2020-03-17 14:13 ` Philippe Mathieu-Daudé
2020-03-17 15:13 ` Markus Armbruster
2020-03-17 15:39 ` Markus Armbruster
2 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-17 14:13 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, qemu-devel
Cc: alxndr, ashijeetacharya, paul.durrant, armbru, qemu-block
On 3/17/20 1:57 PM, Vladimir Sementsov-Ogievskiy wrote:
> 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.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>
> Forgive me for sending this into your series, but seems it is very
> appropriate.
>
> It's rephrasing of my
> [PATCH v9 03/10] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
> for partI series but but without use of ERRP_AUTO_PROPAGATE.
>
> hw/sd/ssi-sd.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
> index 91db069212..829797b597 100644
> --- a/hw/sd/ssi-sd.c
> +++ b/hw/sd/ssi-sd.c
> @@ -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)
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
2020-03-17 14:13 ` Philippe Mathieu-Daudé
@ 2020-03-17 15:13 ` Markus Armbruster
2020-03-17 15:39 ` Markus Armbruster
2 siblings, 0 replies; 21+ messages in thread
From: Markus Armbruster @ 2020-03-17 15:13 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy
Cc: qemu-block, qemu-devel, alxndr, paul.durrant, ashijeetacharya,
philmd
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
> 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.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>
> Forgive me for sending this into your series, but seems it is very
> appropriate.
>
> It's rephrasing of my
> [PATCH v9 03/10] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
> for partI series but but without use of ERRP_AUTO_PROPAGATE.
>
> hw/sd/ssi-sd.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
> index 91db069212..829797b597 100644
> --- a/hw/sd/ssi-sd.c
> +++ b/hw/sd/ssi-sd.c
> @@ -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)
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
2020-03-17 14:13 ` Philippe Mathieu-Daudé
2020-03-17 15:13 ` Markus Armbruster
@ 2020-03-17 15:39 ` Markus Armbruster
2 siblings, 0 replies; 21+ messages in thread
From: Markus Armbruster @ 2020-03-17 15:39 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy
Cc: alxndr, ashijeetacharya, philmd, qemu-devel, qemu-block
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
> 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.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>
> Forgive me for sending this into your series, but seems it is very
> appropriate.
>
> It's rephrasing of my
> [PATCH v9 03/10] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
> for partI series but but without use of ERRP_AUTO_PROPAGATE.
Forgive? Thank you for extracting a bug fix for 5.0! Got more? :)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Minor error handling cleanups
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
` (4 preceding siblings ...)
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
@ 2020-03-17 16:34 ` Markus Armbruster
5 siblings, 0 replies; 21+ messages in thread
From: Markus Armbruster @ 2020-03-17 16:34 UTC (permalink / raw)
To: Markus Armbruster
Cc: vsementsov, qemu-block, qemu-devel, alxndr, paul.durrant,
ashijeetacharya
Queued, including Vladimir's PATCH 4/3. Thanks!
^ permalink raw reply [flat|nested] 21+ messages in thread