mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
char: Explain qmp_chardev_add()'s unusual error handling
Character backend open hasn't been fully converted to the Error API. Some opens fail without setting an error. qmp_chardev_add() needs to detect when that happens, and set a generic error. Explain that in a comment, and inline error_is_set() for clarity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
0aff637e92
commit
3894c78764
@ -3798,7 +3798,13 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
|
||||
break;
|
||||
}
|
||||
|
||||
if (chr == NULL && !error_is_set(errp)) {
|
||||
/*
|
||||
* Character backend open hasn't been fully converted to the Error
|
||||
* API. Some opens fail without setting an error. Set a generic
|
||||
* error then.
|
||||
* TODO full conversion to Error API
|
||||
*/
|
||||
if (chr == NULL && errp && !*errp) {
|
||||
error_setg(errp, "Failed to create chardev");
|
||||
}
|
||||
if (chr) {
|
||||
|
Loading…
Reference in New Issue
Block a user