svn commit: r333831 - head/sys/kern

Matt Macy mmacy at FreeBSD.org
Sat May 19 03:52:56 UTC 2018


Author: mmacy
Date: Sat May 19 03:52:55 2018
New Revision: 333831
URL: https://svnweb.freebsd.org/changeset/base/333831

Log:
  fix uninitialized variable warning in reader locks

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Sat May 19 03:50:29 2018	(r333830)
+++ head/sys/kern/kern_rwlock.c	Sat May 19 03:52:55 2018	(r333831)
@@ -887,7 +887,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
 #ifdef ADAPTIVE_RWLOCKS
 	int spintries = 0;
 	int i, n;
-	enum { READERS, WRITER } sleep_reason;
+	enum { READERS, WRITER } sleep_reason = READERS;
 #endif
 	uintptr_t x;
 #ifdef LOCK_PROFILING

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Sat May 19 03:50:29 2018	(r333830)
+++ head/sys/kern/kern_sx.c	Sat May 19 03:52:55 2018	(r333831)
@@ -551,7 +551,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
 #ifdef ADAPTIVE_SX
 	volatile struct thread *owner;
 	u_int i, n, spintries = 0;
-	enum { READERS, WRITER } sleep_reason;
+	enum { READERS, WRITER } sleep_reason = READERS;
 	bool adaptive;
 #endif
 #ifdef LOCK_PROFILING
@@ -568,7 +568,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
 	int64_t all_time = 0;
 #endif
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
-	uintptr_t state;
+	uintptr_t state = 0;
 #endif
 	int extra_work = 0;
 
@@ -944,7 +944,7 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO
 	int64_t all_time = 0;
 #endif
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
-	uintptr_t state;
+	uintptr_t state = 0;
 #endif
 	int extra_work = 0;
 


More information about the svn-src-head mailing list