From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org,
d-tatianin@yandex-team.ru,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2 10/10] chardev/char: qemu_char_open(): add return value
Date: Fri, 5 Dec 2025 19:34:20 +0400 [thread overview]
Message-ID: <CAMxuvaxRsQiskJYRBB_m3rG3PbBiD2QQLqi8FX-BA_4utep02g@mail.gmail.com> (raw)
In-Reply-To: <20251204154235.149575-11-vsementsov@yandex-team.ru>
[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]
Hi
On Thu, Dec 4, 2025 at 7:42 PM Vladimir Sementsov-Ogievskiy <
vsementsov@yandex-team.ru> wrote:
> 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>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> chardev/char.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/chardev/char.c b/chardev/char.c
> index bdd907f015..e2ec4e15cc 100644
> --- a/chardev/char.c
> +++ b/chardev/char.c
> @@ -246,7 +246,7 @@ 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, Error
> **errp)
> +static bool qemu_char_open(Chardev *chr, ChardevBackend *backend, Error
> **errp)
> {
> ChardevClass *cc = CHARDEV_GET_CLASS(chr);
> /* Any ChardevCommon member would work */
> @@ -262,13 +262,15 @@ static void qemu_char_open(Chardev *chr,
> ChardevBackend *backend, Error **errp)
> }
> chr->logfd = qemu_create(common->logfile, flags, 0666, errp);
> if (chr->logfd < 0) {
> - return;
> + return false;
> }
> }
>
> - if (cc->chr_open) {
> - cc->chr_open(chr, backend, errp);
> + if (!cc->chr_open) {
> + return true;
> }
> +
> + return cc->chr_open(chr, backend, errp);
> }
>
> static void char_init(Object *obj)
> @@ -1007,7 +1009,6 @@ static Chardev *chardev_new(const char *id, const
> char *typename,
> {
> Object *obj;
> Chardev *chr = NULL;
> - Error *local_err = NULL;
>
> assert(g_str_has_prefix(typename, "chardev-"));
> assert(id);
> @@ -1018,9 +1019,7 @@ static Chardev *chardev_new(const char *id, const
> char *typename,
> chr->label = g_strdup(id);
> chr->gcontext = gcontext;
>
> - qemu_char_open(chr, backend, &local_err);
> - if (local_err) {
> - error_propagate(errp, local_err);
> + if (!qemu_char_open(chr, backend, errp)) {
> object_unref(obj);
> return NULL;
> }
> --
> 2.48.1
>
>
[-- Attachment #2: Type: text/html, Size: 3285 bytes --]
next prev parent reply other threads:[~2025-12-05 15:35 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 15:42 [PATCH v2 00/10] chardev: cleanup Vladimir Sementsov-Ogievskiy
2025-12-04 15:42 ` [PATCH v2 01/10] ui/spice: Require spice-server >= 0.15.0 Vladimir Sementsov-Ogievskiy
2025-12-05 15:09 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 02/10] ui/spice: drop SPICE_HAS_ATTACHED_WORKER macro Vladimir Sementsov-Ogievskiy
2025-12-05 15:09 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 03/10] chardev: ChardevClass: consistent naming for handlers Vladimir Sementsov-Ogievskiy
2025-12-05 15:11 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 04/10] chardev: consistent naming for ChardevClass handlers implementations Vladimir Sementsov-Ogievskiy
2025-12-04 15:42 ` [PATCH v2 05/10] chardev: .chr_open(): drop be_opened parameter Vladimir Sementsov-Ogievskiy
2025-12-05 15:14 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 06/10] chardev: .chr_open(): add boolean return value Vladimir Sementsov-Ogievskiy
2025-12-05 15:15 ` Marc-André Lureau
2025-12-05 15:18 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 07/10] chardev/char-pty: store pty_name into PtyChardev state Vladimir Sementsov-Ogievskiy
2025-12-05 15:20 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 08/10] chardev: introduce .chr_get_pty_name() handler Vladimir Sementsov-Ogievskiy
2025-12-05 15:24 ` Marc-André Lureau
2025-12-04 15:42 ` [PATCH v2 09/10] chardev: rework filename handling Vladimir Sementsov-Ogievskiy
2025-12-05 15:33 ` Marc-André Lureau
2025-12-05 21:03 ` Vladimir Sementsov-Ogievskiy
2025-12-04 15:42 ` [PATCH v2 10/10] chardev/char: qemu_char_open(): add return value Vladimir Sementsov-Ogievskiy
2025-12-05 15:34 ` Marc-André Lureau [this message]
2025-12-04 17:14 ` [PATCH v2 00/10] chardev: cleanup 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=CAMxuvaxRsQiskJYRBB_m3rG3PbBiD2QQLqi8FX-BA_4utep02g@mail.gmail.com \
--to=marcandre.lureau@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@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).