[PATCH 39/45] C++: Fix spinlock initialisation

From: David Howells
Date: Sun Apr 01 2018 - 16:44:18 EST


Fix a couple of bits of spinlock initialisation:

(1) owner_cpu is unsigned: set to UINT_MAX rather than -1.

(2) Don't need to cast the result of __SPIN_LOCK_INITIALIZER().

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

include/linux/spinlock_types.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 24b4e6f2c1a2..d1ab81ee85fd 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -41,7 +41,7 @@ typedef struct raw_spinlock {
#ifdef CONFIG_DEBUG_SPINLOCK
# define SPIN_DEBUG_INIT(lockname) \
.magic = SPINLOCK_MAGIC, \
- .owner_cpu = -1, \
+ .owner_cpu = UINT_MAX, \
.owner = SPINLOCK_OWNER_INIT,
#else
# define SPIN_DEBUG_INIT(lockname)
@@ -76,7 +76,7 @@ typedef struct spinlock {
{ { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }

#define __SPIN_LOCK_UNLOCKED(lockname) \
- (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
+ __SPIN_LOCK_INITIALIZER(lockname)

#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)