[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted char
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted chardev |
Date: |
Tue, 28 Aug 2018 00:23:18 +0200 |
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 <address@hidden>
---
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
- Re: [Qemu-devel] [PATCH 2/9] chardev: mark the calls that allow an implicit mux monitor, (continued)
- [Qemu-devel] [PATCH 1/9] char.h: fix gtk-doc comment style, Marc-André Lureau, 2018/08/27
- [Qemu-devel] [PATCH 3/9] chardev: use a child source for qio input source, Marc-André Lureau, 2018/08/27
- [Qemu-devel] [PATCH 4/9] char: update the mux hanlders in class callback, Marc-André Lureau, 2018/08/27
- [Qemu-devel] [PATCH 7/9] chardev: add a note about frontend sources and context switch, Marc-André Lureau, 2018/08/27
- [Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted chardev,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 6/9] terminal3270: do not use backend timer sources, Marc-André Lureau, 2018/08/27
[Qemu-devel] [PATCH 8/9] char-pty: remove check for connection on write, Marc-André Lureau, 2018/08/27
[Qemu-devel] [PATCH 9/9] char-pty: remove write_lock usage, Marc-André Lureau, 2018/08/27