aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2020-09-20 23:20:18 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2020-09-20 23:20:18 +0000
commit7d54cc9165a3990849b60835c85ddb388905e1b7 (patch)
tree52ccf04fda3f52209e8e4f3243d4d50183e23763
parent7149d7209ea20969568edb115ba616866d1828c5 (diff)
downloadsrc-7d54cc9165a3990849b60835c85ddb388905e1b7.tar.gz
src-7d54cc9165a3990849b60835c85ddb388905e1b7.zip
atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr
This was broken in r357940 which introduced the __typeof use. We need the volatile qualifier to be on the pointee not the pointer otherwise it does nothing. This was found by mhorne in D26498, noticing there was a problem (a spin loop condition was hoisted for RISC-V boot code) but not the root cause of it. Reported by: mhorne Reviewed by: mhorne, mjg Approved by: mhorne, mjg Differential Revision: https://reviews.freebsd.org/D26500
Notes
Notes: svn path=/head/; revision=365932
-rw-r--r--sys/sys/atomic_common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h
index 63311b5a3124..a3548977b940 100644
--- a/sys/sys/atomic_common.h
+++ b/sys/sys/atomic_common.h
@@ -41,7 +41,7 @@
#define atomic_load_short(p) (*(volatile u_short *)(p))
#define atomic_load_int(p) (*(volatile u_int *)(p))
#define atomic_load_long(p) (*(volatile u_long *)(p))
-#define atomic_load_ptr(p) (*(volatile __typeof(p))(p))
+#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p))
#define atomic_load_8(p) (*(volatile uint8_t *)(p))
#define atomic_load_16(p) (*(volatile uint16_t *)(p))
#define atomic_load_32(p) (*(volatile uint32_t *)(p))