A "return -err ? err < 0 : err" managed to slip through. So if err was
set, we returned 0 or 1 based on sign, or 0 if err was zero.

If err is negative, we want treat it as an error, so report it back
to the caller, all other values were a success, so convert those to 0.

This should actually be no functional change, as all errors were
reported as 1, and everything else as 0.

Signed-off-by: Chris Wilson <[email protected]>
---
 lib/igt_kmod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index b366adeb..26691e30 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -155,7 +155,7 @@ igt_kmod_load(const char *mod_name, const char *opts)
        }
 out:
        kmod_module_unref(kmod);
-       return -err ? err < 0 : err;
+       return err < 0 ? err : 0;
 }
 
 
@@ -192,7 +192,7 @@ igt_kmod_unload(const char *mod_name, unsigned int flags)
 
 out:
        kmod_module_unref(kmod);
-       return -err ? err < 0 : err;
+       return err < 0 ? err : 0;
 }
 
 /**
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to