# HG changeset patch # User Josef 'Jeff' Sipek # Date 1564073014 14400 # Node ID 7b877f2b343d88ec83da852dc86f9ea0251853cb # Parent 58ae4d8031a5a91f1cd7694374b08dc1c0e96cd5 synch: use generic magic/type checking on rwlocks Signed-off-by: Josef 'Jeff' Sipek diff -r 58ae4d8031a5 -r 7b877f2b343d synch.c --- 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)