[PATCH 1/5] hw/core: Remove use of QERR_UNSUPPORTED

Philippe Mathieu-Daudé posted 5 patches 4 years, 3 months ago
[PATCH 1/5] hw/core: Remove use of QERR_UNSUPPORTED
Posted by Philippe Mathieu-Daudé 4 years, 3 months ago
QERR_UNSUPPORTED definition is obsolete since 2015 (commit
4629ed1e989, "qerror: Finally unused, clean up"). Replace it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/core/nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index 481c4b3c7e5..b4b4a1ed286 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -70,7 +70,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
     if (ns.handled) {
         error_propagate(errp, ns.err);
     } else {
-        error_setg(errp, QERR_UNSUPPORTED);
+        error_setg(errp, "This command is not currently supported");
     }
 }
 
-- 
2.31.1

Re: [PATCH 1/5] hw/core: Remove use of QERR_UNSUPPORTED
Posted by Markus Armbruster 4 years, 2 months ago
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> QERR_UNSUPPORTED definition is obsolete since 2015 (commit
> 4629ed1e989, "qerror: Finally unused, clean up"). Replace it.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/core/nmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/nmi.c b/hw/core/nmi.c
> index 481c4b3c7e5..b4b4a1ed286 100644
> --- a/hw/core/nmi.c
> +++ b/hw/core/nmi.c
> @@ -70,7 +70,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
>      if (ns.handled) {
>          error_propagate(errp, ns.err);
>      } else {
> -        error_setg(errp, QERR_UNSUPPORTED);
> +        error_setg(errp, "This command is not currently supported");
>      }
>  }

I think this error message doesn't quite fit here.

We error out when the QOM composition tree does not contain an object
providing interface "nmi".  We don't tell the user, though.  This isn't
terrible, because the suitable objects are generally created by board
code, so whether the command works generally depends only on the machine
type.  Still, a bit more detail in the error message wouldn't hurt,
would it?  Say "machine does not support NMIs".