Message ID | 20211029230147.2465055-6-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/core: Remove uses of obsolete QERR_ definitions | expand |
Philippe Mathieu-Daudé <philmd@redhat.com> writes: > QERR_INVALID_PARAMETER_VALUE definition is obsolete since 2015 > (commit 4629ed1e989, "qerror: Finally unused, clean up"). > Replace the definitions used in hw/core/. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > hw/core/qdev-properties-system.c | 2 +- > monitor/misc.c | 3 +-- > softmmu/cpus.c | 3 +-- > softmmu/qdev-monitor.c | 7 +++---- > 4 files changed, 6 insertions(+), 9 deletions(-) > > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c > index a91f60567aa..91b322fe372 100644 > --- a/hw/core/qdev-properties-system.c > +++ b/hw/core/qdev-properties-system.c > @@ -749,7 +749,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, > return; > } > if (value < -1 || value > 255) { > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, > + error_setg(errp, "Parameter '%s' expects %s", > name ? name : "null", "a value between -1 and 255"); > return; > } Not this patch's problem, but here goes anyway: if @name can be null, the error message is crap. If it can't, the code is crap. > diff --git a/monitor/misc.c b/monitor/misc.c > index ffe79668706..5a33458173e 100644 > --- a/monitor/misc.c > +++ b/monitor/misc.c > @@ -125,8 +125,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, > if (has_cpu_index) { > int ret = monitor_set_cpu(&hmp.common, cpu_index); > if (ret < 0) { > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", > - "a CPU number"); > + error_setg(errp, "Parameter 'cpu-index' expects a CPU number"); > goto out; > } > } > diff --git a/softmmu/cpus.c b/softmmu/cpus.c > index 071085f840b..0e7f44154fa 100644 > --- a/softmmu/cpus.c > +++ b/softmmu/cpus.c > @@ -741,8 +741,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, > > cpu = qemu_get_cpu(cpu_index); > if (cpu == NULL) { > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", > - "a CPU number"); > + error_setg(errp, "Parameter 'cpu-index' expects a CPU number"); > return; > } > > diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c > index 35a885a6623..27f3a1248ac 100644 > --- a/softmmu/qdev-monitor.c > +++ b/softmmu/qdev-monitor.c > @@ -241,16 +241,15 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) > } > > if (object_class_is_abstract(oc)) { > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", > - "a non-abstract device type"); > + error_setg(errp, > + "Parameter 'driver' expects a non-abstract device type"); > return NULL; > } > > dc = DEVICE_CLASS(oc); > if (!dc->user_creatable || > (phase_check(PHASE_MACHINE_READY) && !dc->hotpluggable)) { > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", > - "a pluggable device type"); > + error_setg(errp, "Parameter 'driver' expects a pluggable device type"); > return NULL; > } Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index a91f60567aa..91b322fe372 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -749,7 +749,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, return; } if (value < -1 || value > 255) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + error_setg(errp, "Parameter '%s' expects %s", name ? name : "null", "a value between -1 and 255"); return; } diff --git a/monitor/misc.c b/monitor/misc.c index ffe79668706..5a33458173e 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -125,8 +125,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, if (has_cpu_index) { int ret = monitor_set_cpu(&hmp.common, cpu_index); if (ret < 0) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", - "a CPU number"); + error_setg(errp, "Parameter 'cpu-index' expects a CPU number"); goto out; } } diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 071085f840b..0e7f44154fa 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -741,8 +741,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, cpu = qemu_get_cpu(cpu_index); if (cpu == NULL) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", - "a CPU number"); + error_setg(errp, "Parameter 'cpu-index' expects a CPU number"); return; } diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 35a885a6623..27f3a1248ac 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -241,16 +241,15 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) } if (object_class_is_abstract(oc)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", - "a non-abstract device type"); + error_setg(errp, + "Parameter 'driver' expects a non-abstract device type"); return NULL; } dc = DEVICE_CLASS(oc); if (!dc->user_creatable || (phase_check(PHASE_MACHINE_READY) && !dc->hotpluggable)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", - "a pluggable device type"); + error_setg(errp, "Parameter 'driver' expects a pluggable device type"); return NULL; }
QERR_INVALID_PARAMETER_VALUE definition is obsolete since 2015 (commit 4629ed1e989, "qerror: Finally unused, clean up"). Replace the definitions used in hw/core/. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- hw/core/qdev-properties-system.c | 2 +- monitor/misc.c | 3 +-- softmmu/cpus.c | 3 +-- softmmu/qdev-monitor.c | 7 +++---- 4 files changed, 6 insertions(+), 9 deletions(-)