i915.live_selftests takes 3 options:
  0: do nothing
 -1: run selftests and prevent continuation of device probing
  1: run selftests, and allow continuation of device probing

Currently, we prevent the device from being loaded if the live selftests
fail. This seems reasonable, since the selftests indicate something is
amiss with the driver. But it does prevent the driver being used
even with a minor fault, and so prevent further inspection of the driver
state afterwards.

Signed-off-by: Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/selftests/i915_selftest.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c 
b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index 1bc11c09faef..6d1fa2b25cbf 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -200,23 +200,23 @@ int i915_mock_selftests(void)
 
 int i915_live_selftests(struct pci_dev *pdev)
 {
-       int err;
+       int err = 0;
 
        if (!i915_selftest.live)
                return 0;
 
        err = run_selftests(live, pdev_to_i915(pdev));
-       if (err) {
-               i915_selftest.live = err;
-               return err;
-       }
-
        if (i915_selftest.live < 0) {
-               i915_selftest.live = -ENOTTY;
-               return 1;
+               /* Abort module probe in case we destablised the system */
+               if (err == 0) {
+                       i915_selftest.live = -ENOTTY;
+                       err = 1;
+               } else {
+                       i915_selftest.live = err;
+               }
        }
 
-       return 0;
+       return err;
 }
 
 int i915_perf_selftests(struct pci_dev *pdev)
-- 
2.20.1

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

Reply via email to