[igt-dev] [PATCH i-g-t] lib: Fix strcmp() direction for bsearch.
Petri Latvala
petri.latvala at intel.com
Mon Sep 3 09:51:26 UTC 2018
On Mon, Sep 03, 2018 at 10:46:29AM +0100, Chris Wilson wrote:
> I fluked out as vgem was the initial mid value, hidding 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 <petri.latvala at intel.com>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala at intel.com>
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
One more lurking bug is that if there's a drm device that's not
recognized, its fd is silently just returned even if the test
requested DRIVER_SOMETHING_SPECIFIC.
> ---
> lib/drmtest.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index bfb38f1e9..adff1a81f 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;
> --
> 2.19.0.rc1
>
More information about the igt-dev
mailing list