All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 4/5] hw/core: Remove uses of QERR_PROPERTY_VALUE_BAD
Date: Fri, 19 Nov 2021 07:51:38 +0100	[thread overview]
Message-ID: <87fsrsskn9.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20211029230147.2465055-5-philmd@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Sat, 30 Oct 2021 01:01:46 +0200")

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> QERR_PROPERTY_VALUE_BAD definition is obsolete since 2015 (commit
> 4629ed1e989, "qerror: Finally unused, clean up"). Replace the two
> uses and drop the definition.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/qapi/qmp/qerror.h | 3 ---
>  hw/core/qdev-properties.c | 2 +-
>  target/i386/cpu.c         | 2 +-
>  3 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
> index f49ae01cdb0..a3f44fc4a1e 100644
> --- a/include/qapi/qmp/qerror.h
> +++ b/include/qapi/qmp/qerror.h
> @@ -50,9 +50,6 @@
>  #define QERR_PERMISSION_DENIED \
>      "Insufficient permission to perform this operation"
>  
> -#define QERR_PROPERTY_VALUE_BAD \
> -    "Property '%s.%s' doesn't take value '%s'"
> -
>  #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
>      "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
>  
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index c34aac6ebc9..dbea4cf8e5e 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -663,7 +663,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
>          break;
>      default:
>      case -EINVAL:
> -        error_setg(errp, QERR_PROPERTY_VALUE_BAD,
> +        error_setg(errp, "Property '%s.%s' doesn't take value '%s'",
>                     object_get_typename(obj), name, value);
>          break;
>      case -ENOENT:
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index fc3ed80ef1e..bc63b80e5bd 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -4469,7 +4469,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value,
>      int i;
>  
>      if (strlen(value) != CPUID_VENDOR_SZ) {
> -        error_setg(errp, QERR_PROPERTY_VALUE_BAD, "", "vendor", value);
> +        error_setg(errp, "Property '.vendor' doesn't take value '%s'", value);
>          return;
>      }

We error out unless the string has exactly CPUID_VENDOR_SZ characters.
We don't tell the user, though[*].  We should!

If this patch was long, I'd separate the long & mechanical from the
error message improvement.  Since it isn't, I suggest to make the error
message improvement the patch's subject, and include the removal of
QERR_PROPERTY_VALUE_BAD "while there".  You choose how to structure
this.


[*] This is a common issue with error systems that make new error
messages harder than reusing some existing message.



  parent reply	other threads:[~2021-11-19  6:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 23:01 [PATCH 0/5] hw/core: Remove uses of obsolete QERR_ definitions Philippe Mathieu-Daudé
2021-10-29 23:01 ` [PATCH 1/5] hw/core: Remove use of QERR_UNSUPPORTED Philippe Mathieu-Daudé
2021-11-19  7:01   ` Markus Armbruster
2021-10-29 23:01 ` [PATCH 2/5] hw/core: Remove use of QERR_FEATURE_DISABLED Philippe Mathieu-Daudé
2021-11-19  8:18   ` Markus Armbruster
2021-10-29 23:01 ` [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG Philippe Mathieu-Daudé
2021-11-19  8:20   ` Markus Armbruster
2021-11-19 11:27     ` Damien Hedde
2021-10-29 23:01 ` [PATCH 4/5] hw/core: Remove uses of QERR_PROPERTY_VALUE_BAD Philippe Mathieu-Daudé
2021-11-02  9:47   ` Damien Hedde
2021-11-02 11:59     ` Philippe Mathieu-Daudé
2021-11-19  6:51   ` Markus Armbruster [this message]
2021-10-29 23:01 ` [PATCH 5/5] hw/core: Remove uses of QERR_INVALID_PARAMETER_VALUE Philippe Mathieu-Daudé
2021-11-19  8:27   ` Markus Armbruster
2021-11-02  9:51 ` [PATCH 0/5] hw/core: Remove uses of obsolete QERR_ definitions Damien Hedde
2021-11-02 11:58   ` Philippe Mathieu-Daudé
2021-11-19  8:35 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsrsskn9.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.