We can use __atomic_load_n() saving a store and load from the _val.

Signed-off-by: Pranith Kumar <[email protected]>
---
 include/qemu/atomic.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 878fa07..6775603 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -144,9 +144,7 @@
 #define atomic_load_acquire(ptr)                        \
     ({                                                  \
     QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *));   \
-    typeof_strip_qual(*ptr) _val;                       \
-    __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE);        \
-    _val;                                               \
+    __atomic_load_n(ptr, __ATOMIC_ACQUIRE);             \
     })
 
 #define atomic_store_release(ptr, i)  do {              \
-- 
2.10.2


Reply via email to