Patchwork [2/8] chr: check to see if front end has registered a read function

login
register
mail settings
Submitter Anthony Liguori
Date Feb. 26, 2012, 11:46 p.m.
Message ID <1330299995-8688-3-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/143133/
State New
Headers show

Comments

Anthony Liguori - Feb. 26, 2012, 11:46 p.m.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qemu-char.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 5b2b35e..22bfb29 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -160,7 +160,9 @@  int qemu_chr_be_can_write(CharDriverState *s)
 
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
 {
-    s->chr_read(s->handler_opaque, buf, len);
+    if (s->chr_read) {
+        s->chr_read(s->handler_opaque, buf, len);
+    }
 }
 
 int qemu_chr_fe_get_msgfd(CharDriverState *s)