[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] exec: Remove the duplicated check in parse_cpu_option()
From: |
Greg Kurz |
Subject: |
Re: [PATCH] exec: Remove the duplicated check in parse_cpu_option() |
Date: |
Fri, 6 Dec 2019 17:58:40 +0100 |
On Fri, 6 Dec 2019 17:33:37 +1100
Gavin Shan <address@hidden> wrote:
> The @cpu_option shouldn't be NULL, otherwise assertion from g_strsplit()
> should be raised as below message indicates. So it's meaningless to validate
> @model_pices[0] in parse_cpu_option() as it shouldn't be NULL either.
>
> qemu-system-aarch64: GLib: g_strsplit: assertion 'string != NULL' failed
>
> This just removes the check and unused message.
>
Hrm... the check isn't about @cpu_option being NULL. It is about filtering out
invalid syntaxes like:
-cpu ''
or
-cpu ,some-prop
> Signed-off-by: Gavin Shan <address@hidden>
> ---
> exec.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index ffdb518535..3cff459e43 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -963,11 +963,6 @@ const char *parse_cpu_option(const char *cpu_option)
> const char *cpu_type;
>
> model_pieces = g_strsplit(cpu_option, ",", 2);
> - if (!model_pieces[0]) {
> - error_report("-cpu option cannot be empty");
> - exit(1);
> - }
> -
> oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
> if (oc == NULL) {
> error_report("unable to find CPU model '%s'", model_pieces[0]);