summary refs log tree commit diff
path: root/kernel/mutex-debug.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-01-11 14:41:26 +0000
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 08:14:16 -0800
commita4fc7ab1d065a9dd89ed0e74439ef87d4a16e980 (patch)
tree6312597ad183ee45e8769b1bc5b0035bfa681d64 /kernel/mutex-debug.c
parenta8b9ee7396ccc8db3bdb4108993556acbe2d3527 (diff)
downloadlinux-a4fc7ab1d065a9dd89ed0e74439ef87d4a16e980.tar.gz
[PATCH] fix/simplify mutex debugging code
Let's switch mutex_debug_check_no_locks_freed() to take (addr, len) as
arguments instead, since all its callers were just calculating the 'to'
address for themselves anyway... (and sometimes doing so badly).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/mutex-debug.c')
-rw-r--r--kernel/mutex-debug.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/mutex-debug.c b/kernel/mutex-debug.c
index 6f829058ae4a..f4913c376950 100644
--- a/kernel/mutex-debug.c
+++ b/kernel/mutex-debug.c
@@ -333,9 +333,10 @@ void mutex_debug_check_no_locks_held(struct task_struct *task)
  * is destroyed or reinitialized - this code checks whether there is
  * any held lock in the memory range of <from> to <to>:
  */
-void mutex_debug_check_no_locks_freed(const void *from, const void *to)
+void mutex_debug_check_no_locks_freed(const void *from, unsigned long len)
 {
 	struct list_head *curr, *next;
+	const void *to = from + len;
 	unsigned long flags;
 	struct mutex *lock;
 	void *lock_addr;
@@ -437,7 +438,7 @@ void debug_mutex_init(struct mutex *lock, const char *name)
 	/*
 	 * Make sure we are not reinitializing a held lock:
 	 */
-	mutex_debug_check_no_locks_freed((void *)lock, (void *)(lock + 1));
+	mutex_debug_check_no_locks_freed((void *)lock, sizeof(*lock));
 	lock->owner = NULL;
 	INIT_LIST_HEAD(&lock->held_list);
 	lock->name = name;