Like the previous change, the function lookup_chain_cache_add() returns
the pointer of the lock chain if the chain is new.
No functional change.
Signed-off-by: Yuyang Du <[email protected]>
---
kernel/locking/lockdep.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 3546894..d545b6c 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2796,13 +2796,13 @@ static inline struct lock_chain *lookup_chain_cache(u64 chain_key)
/*
* If the key is not present yet in dependency chain cache then
- * add it and return 1 - in this case the new dependency chain is
- * validated. If the key is already hashed, return 0.
- * (On return with 1 graph_lock is held.)
+ * add it and return the chain - in this case the new dependency
+ * chain will be validated. If the key is already hashed, return
+ * NULL. (On return with the new chain graph_lock is held.)
*/
-static inline int lookup_chain_cache_add(struct task_struct *curr,
- struct held_lock *hlock,
- u64 chain_key)
+static inline struct lock_chain *
+lookup_chain_cache_add(struct task_struct *curr, struct held_lock *hlock,
+ u64 chain_key)
{
struct lock_class *class = hlock_class(hlock);
struct lock_chain *chain = lookup_chain_cache(chain_key);
@@ -2810,7 +2810,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr,
if (chain) {
cache_hit:
if (!check_no_collision(curr, hlock, chain))
- return 0;
+ return NULL;
if (very_verbose(class)) {
printk("\nhash chain already cached, key: "
@@ -2819,7 +2819,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr,
class->key, class->name);
}
- return 0;
+ return NULL;
}
if (very_verbose(class)) {
@@ -2828,7 +2828,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr,
}
if (!graph_lock())
- return 0;
+ return NULL;
/*
* We have to walk the chain again locked - to avoid duplicates:
@@ -2839,10 +2839,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr,
goto cache_hit;
}
- if (!add_chain_cache(curr, hlock, chain_key))
- return 0;
-
- return 1;
+ return add_chain_cache(curr, hlock, chain_key);
}
static int validate_chain(struct task_struct *curr,
--
1.8.3.1