summaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2012-10-19 16:57:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-19 17:07:48 -0400
commitfe73fbe1c5eda709084dedb66cbdd4b86826cce7 (patch)
tree14b8e5919cd00b1c38ddff56eebb00c17c4d2905 /lib/dma-debug.c
parent0db63d7e25f96e2c6da925c002badf6f144ddf30 (diff)
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 <ming.lei@canonical.com> Reported-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Joerg Roedel <joerg.roedel@amd.com> Tested-by: Shuah Khan <shuah.khan@hp.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c4
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,
264 match_fn match) 264 match_fn match)
265{ 265{
266 struct dma_debug_entry *entry, *ret = NULL; 266 struct dma_debug_entry *entry, *ret = NULL;
267 int matches = 0, match_lvl, last_lvl = 0; 267 int matches = 0, match_lvl, last_lvl = -1;
268 268
269 list_for_each_entry(entry, &bucket->list, list) { 269 list_for_each_entry(entry, &bucket->list, list) {
270 if (!match(ref, entry)) 270 if (!match(ref, entry))
@@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
293 } else if (match_lvl > last_lvl) { 293 } else if (match_lvl > last_lvl) {
294 /* 294 /*
295 * We found an entry that fits better then the 295 * We found an entry that fits better then the
296 * previous one 296 * previous one or it is the 1st match.
297 */ 297 */
298 last_lvl = match_lvl; 298 last_lvl = match_lvl;
299 ret = entry; 299 ret = entry;