From 125eee6e981eac0a004aeb4f327439a132ceac5c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 3 Sep 2018 10:44:31 +0100 Subject: lib: Fix strcmp() direction for bsearch. I fluked out as vgem was the initial mid value, hiding the worst of the errors as i915 matched with DRIVER_ANY. Fixes: 20087bf22698 ("lib: Use a bsearch to find the module name") Reported-by: Petri Latvala Signed-off-by: Chris Wilson Cc: Petri Latvala Reviewed-by: Petri Latvala --- lib/drmtest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/drmtest.c') diff --git a/lib/drmtest.c b/lib/drmtest.c index bfb38f1e..adff1a81 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -226,9 +226,9 @@ static int open_device(const char *name, unsigned int chipset) int mid = start + (end - start) / 2; int ret = strcmp(modules[mid].module, dev_name); if (ret < 0) { - end = mid; - } else if (ret > 0) { start = mid + 1; + } else if (ret > 0) { + end = mid; } else { chip = modules[mid].bit; break; -- cgit v1.2.3