Laszlo Ersek <ler...@redhat.com> writes: > Conversion status (call chains covered or substituted by error propagation > marked with square brackets): > > do_device_add -> [qemu_find_opts -> error_report] > do_device_add -> qdev_device_add -> qerror_report > do_device_add -> qdev_device_add -> [qbus_find -> qbus_find_recursive > -> qerror_report] > do_device_add -> qdev_device_add -> [qbus_find -> qerror_report] > do_device_add -> qdev_device_add -> [set_property -> qdev_prop_parse > -> qerror_report_err] > > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > hw/qdev-monitor.c | 30 ++++++++++++++++-------------- > 1 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c > index 728aa24..80fc9f8 100644 > --- a/hw/qdev-monitor.c > +++ b/hw/qdev-monitor.c > @@ -371,20 +371,20 @@ static BusState *qbus_find(const char *path, Error > **errp) > bus = sysbus_get_default(); > pos = 0; > } else { > - Error *err = NULL; > + Error *named_bus_full = NULL; > > if (sscanf(path, "%127[^/]%n", elem, &len) != 1) { > assert(!path[0]); > elem[0] = len = 0; > } > - bus = qbus_find_recursive(sysbus_get_default(), elem, NULL, &err); > + bus = qbus_find_recursive(sysbus_get_default(), elem, NULL, > + &named_bus_full); > if (!bus) { > - if (error_is_set(&err)) { > - qerror_report_err(err); > - error_free(err); > - } else { > - qerror_report(QERR_BUS_NOT_FOUND, elem); > - } > + Error *not_found = NULL; > + > + error_set(¬_found, QERR_BUS_NOT_FOUND, elem); > + error_propagate(errp, named_bus_full); > + error_propagate(errp, not_found); > return NULL; > } > pos = len;
Cute trick! Would look even cuter if we had a function returning a newly minted error object. [...]