diff mbox

[01/10] qdev: Don't stop applying globals on first error

Message ID 1466022773-8965-2-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost June 15, 2016, 8:32 p.m. UTC
qdev_prop_set_globals_for_type() stops applying global properties
on the first error. It is a leftover from when QEMU exited on any
error when applying global property. Now we print a warning about
the first error, bug ignore all other global properties after it.

For example, the following command-line will not set CPUID level
to 3, but will warn only about "x86_64-cpu.vendor" being ignored.

  $ ./x86_64-softmmu/qemu-system-x86_64 \
      -global x86_64-cpu.vendor=x \
      -global x86_64-cpu.level=3
  qemu-system-x86_64: Warning: global x86_64-cpu.vendor=x ignored: Property '.vendor' doesn't take value 'x'

Fix this by not returning from qdev_prop_set_globals_for_type()
on the first error.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/core/qdev-properties.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Marcel Apfelbaum June 19, 2016, 4:40 p.m. UTC | #1
On 06/15/2016 11:32 PM, Eduardo Habkost wrote:
> qdev_prop_set_globals_for_type() stops applying global properties
> on the first error. It is a leftover from when QEMU exited on any
> error when applying global property. Now we print a warning about
> the first error, bug ignore all other global properties after it.
>
> For example, the following command-line will not set CPUID level
> to 3, but will warn only about "x86_64-cpu.vendor" being ignored.
>
>    $ ./x86_64-softmmu/qemu-system-x86_64 \
>        -global x86_64-cpu.vendor=x \
>        -global x86_64-cpu.level=3
>    qemu-system-x86_64: Warning: global x86_64-cpu.vendor=x ignored: Property '.vendor' doesn't take value 'x'
>
> Fix this by not returning from qdev_prop_set_globals_for_type()
> on the first error.
>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   hw/core/qdev-properties.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index e3b2184..c10edee 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1088,7 +1088,6 @@ static void qdev_prop_set_globals_for_type(DeviceState *dev,
>               assert(prop->user_provided);
>               error_reportf_err(err, "Warning: global %s.%s=%s ignored: ",
>                                 prop->driver, prop->property, prop->value);
> -            return;
>           }
>       }
>   }
>

Is always nice to have more warnings.

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel
Markus Armbruster June 20, 2016, 7:43 a.m. UTC | #2
Eduardo Habkost <ehabkost@redhat.com> writes:

> qdev_prop_set_globals_for_type() stops applying global properties
> on the first error. It is a leftover from when QEMU exited on any
> error when applying global property. Now we print a warning about
> the first error, bug ignore all other global properties after it.

Might want to add "Messed up in commit 25f8dd9."

> For example, the following command-line will not set CPUID level
> to 3, but will warn only about "x86_64-cpu.vendor" being ignored.
>
>   $ ./x86_64-softmmu/qemu-system-x86_64 \
>       -global x86_64-cpu.vendor=x \
>       -global x86_64-cpu.level=3
>   qemu-system-x86_64: Warning: global x86_64-cpu.vendor=x ignored: Property '.vendor' doesn't take value 'x'
>
> Fix this by not returning from qdev_prop_set_globals_for_type()
> on the first error.
>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox

Patch

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index e3b2184..c10edee 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1088,7 +1088,6 @@  static void qdev_prop_set_globals_for_type(DeviceState *dev,
             assert(prop->user_provided);
             error_reportf_err(err, "Warning: global %s.%s=%s ignored: ",
                               prop->driver, prop->property, prop->value);
-            return;
         }
     }
 }