Just setting a reasonable error string using error_setg() is
simpler and makes error messages clearer.

Before:

  $ qemu-system-s390x -device x-terminal3270,devno=x
  qemu-system-s390x: -device x-terminal3270,devno=x: Property 
'x-terminal3270.devno' doesn't take value 'x'

After:

  $ qemu-system-s390x -device x-terminal3270,devno=x
  qemu-system-s390x: -device x-terminal3270,devno=x: Property 
'x-terminal3270.devno' can't take value 'x': invalid devno

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
Cc: Cornelia Huck <coh...@redhat.com>
Cc: Thomas Huth <th...@redhat.com>
Cc: Richard Henderson <r...@twiddle.net>
Cc: David Hildenbrand <da...@redhat.com>
Cc: Halil Pasic <pa...@linux.ibm.com>
Cc: Christian Borntraeger <borntrae...@de.ibm.com>
Cc: qemu-s3...@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/s390x/css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index c8e7ce232a..ad631bad29 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -2384,7 +2384,7 @@ static void set_css_devid(Object *obj, Visitor *v, const 
char *name,
 
     num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2);
     if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) {
-        error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
+        error_setg(errp, "invalid devno");
         goto out;
     }
     if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) {
-- 
2.28.0


Reply via email to