Message ID | 20181012002217.2864-5-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | chardev: Convert IO handlers to use unsigned type | expand |
diff --git a/chardev/char.c b/chardev/char.c index e115166995..952f9c9bcc 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -159,12 +159,15 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all) int qemu_chr_be_can_write(Chardev *s) { CharBackend *be = s->be; + int res; if (!be || !be->chr_can_read) { return 0; } - return be->chr_can_read(be->opaque); + res = be->chr_can_read(be->opaque); + assert(res >= 0); + return res; } void qemu_chr_be_write_impl(Chardev *s, uint8_t *buf, int len)
Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- chardev/char.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)