[libvirt] [PULL 45/45] numa: Clean up error reporting in parse_numa()
David Gibson
david at gibson.dropbear.id.au
Tue Oct 23 15:27:23 UTC 2018
On Thu, Oct 18, 2018 at 05:04:22PM -0300, Eduardo Habkost wrote:
> From: Markus Armbruster <armbru at redhat.com>
>
> Calling error_report() in a function that takes an Error ** argument
> is suspicious. parse_numa() does that, and then fails without setting
> an error. Its caller main(), via qemu_opts_foreach(), is fine with
> it, but clean it up anyway.
>
> While there, give parse_numa() internal linkage.
>
> Cc: Eduardo Habkost <ehabkost at redhat.com>
> Signed-off-by: Markus Armbruster <armbru at redhat.com>
> Message-Id: <20181008173125.19678-26-armbru at redhat.com>
> Reviewed-by: Eduardo Habkost <ehabkost at redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
> ---
> include/sysemu/numa.h | 1 -
> numa.c | 8 +++-----
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
> index 7a0ae751aa..21713b7e2f 100644
> --- a/include/sysemu/numa.h
> +++ b/include/sysemu/numa.h
> @@ -22,7 +22,6 @@ struct NumaNodeMem {
> };
>
> extern NodeInfo numa_info[MAX_NODES];
> -int parse_numa(void *opaque, QemuOpts *opts, Error **errp);
> void parse_numa_opts(MachineState *ms);
> void numa_complete_configuration(MachineState *ms);
> void query_numa_node_mem(NumaNodeMem node_mem[]);
> diff --git a/numa.c b/numa.c
> index 1d7c49ad43..50ec016013 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -215,7 +215,7 @@ end:
> error_propagate(errp, err);
> }
>
> -int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
> +static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
> {
> NumaOptions *object = NULL;
> MachineState *ms = MACHINE(opaque);
> @@ -239,7 +239,7 @@ int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
> end:
> qapi_free_NumaOptions(object);
> if (err) {
> - error_report_err(err);
> + error_propagate(errp, err);
> return -1;
> }
>
> @@ -444,9 +444,7 @@ void numa_complete_configuration(MachineState *ms)
>
> void parse_numa_opts(MachineState *ms)
> {
> - if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) {
> - exit(1);
> - }
> + qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal);
> }
>
> void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181023/19ea854d/attachment-0001.sig>
More information about the libvir-list
mailing list