Removed a pair of qemu_mutex_lock and its respective qemu_mutex_unlock
and used a QEMU_LOCK_GUARD instead. This improves readability by
removing the call to qemu_mutex_unlock.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
chardev/char.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/chardev/char.c b/chardev/char.c
index 97cafd6849..2b0bc1325c 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -115,7 +115,7 @@ static int qemu_chr_write_buffer(Chardev *s,
int res = 0;
*offset = 0;
- qemu_mutex_lock(&s->chr_write_lock);
+ QEMU_LOCK_GUARD(&s->chr_write_lock);
while (*offset < len) {
retry:
res = cc->chr_write(s, buf + *offset, len - *offset);
@@ -153,7 +153,6 @@ static int qemu_chr_write_buffer(Chardev *s,
*/
qemu_chr_write_log(s, buf, len);
}
- qemu_mutex_unlock(&s->chr_write_lock);
return res;
}
--
2.25.1