[PATCH 1/1] lockdep: cleanup duplicated variable

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yong Zhang
Date: Monday, June 1, 2009 - 2:51 am

Because of using variable i to keep chain depth and with graph_lock
being held, only one variable is enough.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
---
 kernel/lockdep.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 8bbeef9..89f2d15 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1641,7 +1641,7 @@ static inline int lookup_chain_cache(struct task_struct *curr,
 	struct lock_class *class = hlock_class(hlock);
 	struct list_head *hash_head = chainhashentry(chain_key);
 	struct lock_chain *chain;
-	struct held_lock *hlock_curr, *hlock_next;
+	struct held_lock *hlock_next;
 	int i, j, n, cn;
 
 	if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
@@ -1693,12 +1693,10 @@ cache_hit:
 	chain->chain_key = chain_key;
 	chain->irq_context = hlock->irq_context;
 	/* Find the first held_lock of current chain */
-	hlock_next = hlock;
 	for (i = curr->lockdep_depth - 1; i >= 0; i--) {
-		hlock_curr = curr->held_locks + i;
-		if (hlock_curr->irq_context != hlock_next->irq_context)
+		hlock_next = curr->held_locks + i;
+		if (hlock_next->irq_context != hlock->irq_context)
 			break;
-		hlock_next = hlock;
 	}
 	i++;
 	chain->depth = curr->lockdep_depth + 1 - i;
-- 
1.5.6.5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/1] lockdep: cleanup duplicated variable, Yong Zhang, (Mon Jun 1, 2:51 am)