diff mbox series

[04/20] qdev: Stop using error_set_from_qdev_prop_error() for mac property

Message ID 20201030202131.796967-5-ehabkost@redhat.com
State New
Headers show
Series qdev/qom: Remove explicit type names from error_setg() calls | expand

Commit Message

Eduardo Habkost Oct. 30, 2020, 8:21 p.m. UTC
Just setting a reasonable error string using error_setg() is
simpler and makes error messages clearer.

Before:

  $ qemu-system-x86_64 -device e1000,mac=x
  qemu-system-x86_64: -device e1000,mac=x: Property 'e1000.mac' doesn't take value 'x'

After:

  $ qemu-system-x86_64 -device e1000,mac=x
  qemu-system-x86_64: -device e1000,mac=x: Property 'e1000.mac' can't take value 'x': invalid mac address

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/core/qdev-properties-system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index a5a1a6ffee..fc0abcae17 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -336,7 +336,7 @@  static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
     return;
 
 inval:
-    error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
+    error_setg(errp, "invalid mac address");
     g_free(str);
 }