changeset 760:7b877f2b343d

synch: use generic magic/type checking on rwlocks Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 25 Jul 2019 12:43:34 -0400
parents 58ae4d8031a5
children 9aa886a2355b
files synch.c
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/synch.c	Thu Jul 25 12:15:29 2019 -0400
+++ b/synch.c	Thu Jul 25 12:43:34 2019 -0400
@@ -467,17 +467,6 @@
 		__bad_type(info, op, where, expected_type);
 }
 
-static void check_rw_magic(struct rwlock *lock, const char *op,
-			   const struct lock_context *where)
-{
-	if (lock->info.magic == (uintptr_t) &lock->info)
-		return;
-
-	cmn_err(CE_CRIT, "lockdep: thread trying to %s rwlock with bad magic", op);
-	print_rw(lock, where);
-	panic("lockdep: Aborting - bad rwlock magic");
-}
-
 static void check_cond_magic(struct cond *cond, const char *op,
 			     const struct lock_context *where)
 {
@@ -610,7 +599,7 @@
 	if (!l)
 		print_invalid_call("RWDESTROY", where);
 
-	check_rw_magic(l, "destroy", where);
+	check_magic(&l->info, "destroy", where, SYNCH_TYPE_RW);
 
 	l->info.magic = DESTROYED_MAGIC;
 	/* keep the synch type set to aid debugging */
@@ -622,7 +611,7 @@
 	if (!l)
 		print_invalid_call("RWLOCK", where);
 
-	check_rw_magic(l, "acquire", where);
+	check_magic(&l->info, "acquire", where, SYNCH_TYPE_RW);
 }
 
 static void verify_rw_unlock(const struct lock_context *where, struct rwlock *l)
@@ -630,7 +619,7 @@
 	if (!l)
 		print_invalid_call("RWUNLOCK", where);
 
-	check_rw_magic(l, "release", where);
+	check_magic(&l->info, "release", where, SYNCH_TYPE_RW);
 }
 
 static void verify_cond_init(const struct lock_context *where, struct cond *c)