qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD


From: Mahmoud Mandour
Subject: [PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD
Date: Thu, 11 Mar 2021 05:15:32 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]