Accordingly with recommendations in include/qapi/error.h accompany errp by boolean return value and get rid of error propagation.
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> --- chardev/char.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index d5a2533e8e..64ec60c0f2 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -246,14 +246,20 @@ int qemu_chr_add_client(Chardev *s, int fd) CHARDEV_GET_CLASS(s)->chr_add_client(s, fd) : -1; } -static void qemu_char_open(Chardev *chr, ChardevBackend *backend, +static bool qemu_char_open(Chardev *chr, ChardevBackend *backend, bool *be_opened, Error **errp) { + ERRP_GUARD(); ChardevClass *cc = CHARDEV_GET_CLASS(chr); if (cc->open) { cc->open(chr, backend, be_opened, errp); + if (*errp) { + return false; + } } + + return true; } static void char_init(Object *obj) @@ -1030,9 +1036,7 @@ static Chardev *chardev_new(const char *id, const char *typename, goto fail; } - qemu_char_open(chr, backend, &be_opened, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!qemu_char_open(chr, backend, &be_opened, &local_err)) { goto fail; } -- 2.48.1
