From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: marcandre.lureau@redhat.com, pbonzini@redhat.com,
berrange@redhat.com, eduardo@habkost.net,
qemu-devel@nongnu.org, raphael@enfabrica.net,
yc-core@yandex-team.ru, d-tatianin@yandex-team.ru
Subject: Re: [PATCH v3 3/7] chardev/char: qemu_char_open(): add return value
Date: Wed, 15 Oct 2025 08:37:22 +0200 [thread overview]
Message-ID: <877bwwk6vx.fsf@pond.sub.org> (raw)
In-Reply-To: <20251014152644.954762-4-vsementsov@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Tue, 14 Oct 2025 18:26:40 +0300")
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> 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 <vsementsov@yandex-team.ru>
> ---
> chardev/char.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/chardev/char.c b/chardev/char.c
> index 4a531265c1..c874a2d31e 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)
> @@ -1015,7 +1021,6 @@ static Chardev *chardev_new(const char *id, const char *typename,
> {
> Object *obj;
> Chardev *chr = NULL;
> - Error *local_err = NULL;
> bool be_opened = true;
>
> assert(g_str_has_prefix(typename, "chardev-"));
> @@ -1031,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, errp)) {
> goto fail;
> }
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2025-10-15 6:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 15:26 [PATCH v3 0/7] chardev: postpone connect Vladimir Sementsov-Ogievskiy
2025-10-14 15:26 ` [PATCH v3 1/7] chardev/char-socket: simplify reconnect-ms handling Vladimir Sementsov-Ogievskiy
2025-10-14 15:26 ` [PATCH v3 2/7] chardev/char: split chardev_init_logfd() out of qemu_char_open() Vladimir Sementsov-Ogievskiy
2025-10-15 6:35 ` Markus Armbruster
2025-10-15 6:47 ` Vladimir Sementsov-Ogievskiy
2025-10-14 15:26 ` [PATCH v3 3/7] chardev/char: qemu_char_open(): add return value Vladimir Sementsov-Ogievskiy
2025-10-15 6:37 ` Markus Armbruster [this message]
2025-10-14 15:26 ` [PATCH v3 4/7] chardev/char: move filename and be_opened handling to qemu_char_open() Vladimir Sementsov-Ogievskiy
2025-10-14 15:26 ` [PATCH v3 5/7] chardev/char: introduce .init() + .connect() initialization interface Vladimir Sementsov-Ogievskiy
2025-10-15 6:50 ` Markus Armbruster
2025-10-15 6:58 ` Vladimir Sementsov-Ogievskiy
2025-10-15 7:49 ` Markus Armbruster
2025-10-14 15:26 ` [PATCH v3 6/7] chardev/char-socket: move to .init + .connect api Vladimir Sementsov-Ogievskiy
2025-10-14 15:26 ` [PATCH v3 7/7] chardev: introduce DEFINE_PROP_CHR_NO_CONNECT Vladimir Sementsov-Ogievskiy
2025-10-15 6:56 ` Markus Armbruster
2025-10-15 7:11 ` Vladimir Sementsov-Ogievskiy
2025-10-15 7:55 ` Markus Armbruster
2025-10-15 8:19 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877bwwk6vx.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=eduardo@habkost.net \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=raphael@enfabrica.net \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).