From: Roman Penyaev Date: Mon, 14 Oct 2024 15:24:01 +0000 (+0200) Subject: chardev/char: fix qemu_chr_is_busy() check X-Git-Tag: v9.2.0-rc0~48^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df12798f8791a929f4d7309f67a0f437c608e7fb;p=thirdparty%2Fqemu.git chardev/char: fix qemu_chr_is_busy() check `mux_cnt` struct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check. Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend") Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau Message-ID: <20241014152408.427700-2-r.peniaev@gmail.com> --- diff --git a/chardev/char.c b/chardev/char.c index c0cc52824b4..f54dc3a8628 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -333,7 +333,7 @@ static bool qemu_chr_is_busy(Chardev *s) { if (CHARDEV_IS_MUX(s)) { MuxChardev *d = MUX_CHARDEV(s); - return d->mux_cnt >= 0; + return d->mux_cnt > 0; } else { return s->be != NULL; }