All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] lib/kmod: Fix error reporting for kmod load/unload
@ 2017-08-25 17:28 Chris Wilson
  2017-08-25 17:49 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2017-08-25 17:28 UTC (permalink / raw)
  To: intel-gfx

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 <chris@chris-wilson.co.uk>
---
 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-28  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 17:28 [PATCH igt] lib/kmod: Fix error reporting for kmod load/unload Chris Wilson
2017-08-25 17:49 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-26  0:54 ` ✓ Fi.CI.IGT: " Patchwork
2017-08-28  9:36 ` [PATCH igt] " Petri Latvala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.