diff mbox series

drm/i915/selftests: Allow the module to load even if live selftests fail

Message ID 20210208121523.21716-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Allow the module to load even if live selftests fail | expand

Commit Message

Chris Wilson Feb. 8, 2021, 12:15 p.m. UTC
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 <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_selftest.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

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)