All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted chardev
Date: Tue, 28 Aug 2018 00:23:18 +0200	[thread overview]
Message-ID: <20180827222322.26009-6-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20180827222322.26009-1-marcandre.lureau@redhat.com>

It is futile to call qemu_chr_fe_set_handlers() without an associated
chardev, because the function is doing nothing in that case, not even
reporting an error, it would likely be a programming error. Let's not
handle that hypothetical case.

(fwiw, I introduced the check in commit
94a40fc56036b5058b0b194d9e372a22e65ce7be, that was a mistake imho)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/chardev/char-fe.h | 2 --
 chardev/char-fe.c         | 7 +------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index 21071f1fb1..4677a9e65a 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -82,8 +82,6 @@ bool qemu_chr_fe_backend_open(CharBackend *be);
  *
  * Set the front end char handlers. The front end takes the focus if
  * any of the handler is non-NULL.
- *
- * Without associated Chardev, nothing is changed.
  */
 void qemu_chr_fe_set_handlers(CharBackend *b,
                               IOCanReadHandler *fd_can_read,
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index 6ed8bff46a..e3b1c54721 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -254,14 +254,9 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
                               GMainContext *context,
                               bool set_open)
 {
-    Chardev *s;
+    Chardev *s = b->chr;
     int fe_open;
 
-    s = b->chr;
-    if (!s) {
-        return;
-    }
-
     if (!opaque && !fd_can_read && !fd_read && !fd_event) {
         fe_open = 0;
         remove_fd_in_watch(s);
-- 
2.18.0.547.g1d89318c48

  parent reply	other threads:[~2018-08-27 22:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 22:23 [Qemu-devel] [PATCH 0/9] chardev: various cleanups and improvements Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 1/9] char.h: fix gtk-doc comment style Marc-André Lureau
2018-08-29 16:44   ` Daniel P. Berrangé
2018-08-30 14:38   ` Markus Armbruster
2018-08-27 22:23 ` [Qemu-devel] [PATCH 2/9] chardev: mark the calls that allow an implicit mux monitor Marc-André Lureau
2018-08-30 14:55   ` Markus Armbruster
2018-08-30 16:16     ` Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 3/9] chardev: use a child source for qio input source Marc-André Lureau
2018-08-29 16:48   ` Daniel P. Berrangé
2019-04-04 15:18   ` KONRAD Frederic
2019-04-04 15:44     ` Marc-André Lureau
2019-04-04 15:49       ` KONRAD Frederic
2019-04-05  7:46         ` KONRAD Frederic
2019-04-05  7:46           ` KONRAD Frederic
2018-08-27 22:23 ` [Qemu-devel] [PATCH 4/9] char: update the mux hanlders in class callback Marc-André Lureau
2018-08-30 14:57   ` Markus Armbruster
2018-08-30 16:18     ` Marc-André Lureau
2018-08-31  6:14       ` Markus Armbruster
2018-08-27 22:23 ` Marc-André Lureau [this message]
2018-08-30 14:57   ` [Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted chardev Markus Armbruster
2018-08-30 16:20     ` Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 6/9] terminal3270: do not use backend timer sources Marc-André Lureau
2018-08-28  3:52   ` Peter Xu
2018-08-28  9:09     ` Marc-André Lureau
2018-08-28 10:20       ` Peter Xu
2018-08-28 10:40         ` Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 7/9] chardev: add a note about frontend sources and context switch Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 8/9] char-pty: remove check for connection on write Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 9/9] char-pty: remove write_lock usage Marc-André Lureau

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=20180827222322.26009-6-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.