diff options
| author | Ming Lei <[email protected]> | 2012-10-19 20:57:01 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2012-10-19 21:07:48 +0000 |
| commit | fe73fbe1c5eda709084dedb66cbdd4b86826cce7 (patch) | |
| tree | 14b8e5919cd00b1c38ddff56eebb00c17c4d2905 /lib/dma-debug.c | |
| parent | mm: compaction: correct the nr_strict va isolated check for CMA (diff) | |
| download | kernel-fe73fbe1c5eda709084dedb66cbdd4b86826cce7.tar.gz kernel-fe73fbe1c5eda709084dedb66cbdd4b86826cce7.zip | |
lib/dma-debug.c: fix __hash_bucket_find()
If there is only one match, the unique matched entry should be returned.
Without the fix, the upcoming dma debug interfaces ("dma-debug: new
interfaces to debug dma mapping errors") can't work reliably because
only device and dma_addr are passed to dma_mapping_error().
Signed-off-by: Ming Lei <[email protected]>
Reported-by: Wu Fengguang <[email protected]>
Cc: Joerg Roedel <[email protected]>
Tested-by: Shuah Khan <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/dma-debug.c')
| -rw-r--r-- | lib/dma-debug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index b9087bff008b..d84beb994f36 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -264,7 +264,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket, match_fn match) { struct dma_debug_entry *entry, *ret = NULL; - int matches = 0, match_lvl, last_lvl = 0; + int matches = 0, match_lvl, last_lvl = -1; list_for_each_entry(entry, &bucket->list, list) { if (!match(ref, entry)) @@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket, } else if (match_lvl > last_lvl) { /* * We found an entry that fits better then the - * previous one + * previous one or it is the 1st match. */ last_lvl = match_lvl; ret = entry; |
