Skip to contentSkip to conversation

qdev: show failing device name instead of silently exiting

PATCH In review Amit Shah 3 participants 9 messages Sep 23, 2009 – Sep 25, 2009

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

PATCH 1/1 qdev: show failing device name instead of silently exiting

If initializing a device fails, show the name of the device and then exit

---
 hw/qdev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/qdev.c +1 -0
index 1d79db0..62a6fc7 100644
@@ -203,6 +203,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
     if (qdev_init(qdev) != 0) {
+        qemu_error("Error initializing device %s\n", driver);
         qdev_free(qdev);
         return NULL;
     }
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 2 lines · Amit Shah

If initializing a device fails, show the name of the device and then exit

"and then exit" is misleading, as you don't add an exit.

Quoted 17 lines
---
 hw/qdev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/qdev.c +1 -0
index 1d79db0..62a6fc7 100644
@@ -203,6 +203,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
     if (qdev_init(qdev) != 0) {
+        qemu_error("Error initializing device %s\n", driver);
         qdev_free(qdev);
         return NULL;
     }
author
#2 lore raw

Hey Markus,

Quoted 6 lines · Markus Armbruster
Quoted 2 lines · Amit Shah

If initializing a device fails, show the name of the device and then exit

"and then exit" is misleading, as you don't add an exit.

The 'return NULL' does that -- the calling function exits. (doesn't the subject line clarify that?)

Quoted 5 lines
Quoted 5 lines
---
 hw/qdev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 12 lines

hw/qdev.c DeviceState *qdev_device_add(QemuOpts *opts) · line 209

Quoted 12 lines
hw/qdev.c +1 -0
index 1d79db0..62a6fc7 100644
@@ -203,6 +203,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
     if (qdev_init(qdev) != 0) {
+        qemu_error("Error initializing device %s\n", driver);
         qdev_free(qdev);
         return NULL;
     }

Amit

#3 lore raw
Quoted 5 lines · Amit Shah

Hey Markus,

Quoted 2 lines · Markus Armbruster

Amit Shah <[email protected]> writes:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If initializing a device fails, show the name of the device and then exit

"and then exit" is misleading, as you don't add an exit.

The 'return NULL' does that -- the calling function exits. (doesn't the subject line clarify that?)

You could say "show the name of the device before exiting".

The message as you worded it made me look for an exit where there wasn't one before.

author
#4 lore raw
Quoted 10 lines · Markus Armbruster
Quoted 8 lines · Amit Shah

Hey Markus,

Quoted 5 lines · Markus Armbruster
Quoted 2 lines · Amit Shah

If initializing a device fails, show the name of the device and then exit

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

"and then exit" is misleading, as you don't add an exit.

The 'return NULL' does that -- the calling function exits. (doesn't the subject line clarify that?)

You could say "show the name of the device before exiting".

That's what the subject says! :-)

Quoted 2 lines

The message as you worded it made me look for an exit where there wasn't one before.

I'll respin it nevertheless.

Amit

#5 lore raw
Quoted 18 lines · Amit Shah
Quoted 10 lines · Markus Armbruster
Quoted 8 lines · Amit Shah

Hey Markus,

Quoted 5 lines · Markus Armbruster
Quoted 2 lines · Amit Shah

If initializing a device fails, show the name of the device and then exit

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

"and then exit" is misleading, as you don't add an exit.

The 'return NULL' does that -- the calling function exits. (doesn't the subject line clarify that?)

You could say "show the name of the device before exiting".

Quoted 8 lines

That's what the subject says! :-)

Quoted 2 lines

The message as you worded it made me look for an exit where there wasn't one before.

I'll respin it nevertheless.

Amit

Thanks, and hope you don't mind me being such a stickler for clear commit messages.

author
#6 lore raw
Quoted 3 lines · Markus Armbruster

Thanks, and hope you don't mind me being such a stickler for clear commit messages.

As long as you widen your net -- the commit logs aren't all too good to read :-)

Amit

#7 lore raw
Quoted 7 lines · Amit Shah
Quoted 3 lines · Markus Armbruster

Thanks, and hope you don't mind me being such a stickler for clear commit messages.

As long as you widen your net -- the commit logs aren't all too good to read :-)

It's an all too common complaint in my reviews. It stood out in your case not because the message was particularly bad, only because I couldn't find anything else to complain about :)

#8 lore raw
In reply to Amit Shah
Quoted 5 lines · Amit Shah

Hey Markus,

Quoted 2 lines · Markus Armbruster

Amit Shah<[email protected]> writes:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If initializing a device fails, show the name of the device and then exit

"and then exit" is misleading, as you don't add an exit.

The 'return NULL' does that -- the calling function exits. (doesn't the subject line clarify that?)

I have patches in the queue which will wind up this via device_add monitor command. Caller will *not* exit then ;)

cheers,
Gerd