diff mbox

[2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR

Message ID 1437988648-3829-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 27, 2015, 9:17 a.m. UTC
No need to break module and system loading due to a programming bug.
Remove the BUG_ON and replace with a gentler DRM_ERROR_ON and error
return.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_cmd_parser.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Shuang He July 28, 2015, 8:46 a.m. UTC | #1
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6871
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  297/297              297/297
SNB                                  315/315              315/315
IVB                                  342/342              342/342
BYT                                  284/284              284/284
HSW                                  378/378              378/378
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c
index fd9abe6e0ab1..dcd096536119 100644
--- a/drivers/gpu/drm/i915/i915_cmd_parser.c
+++ b/drivers/gpu/drm/i915/i915_cmd_parser.c
@@ -738,11 +738,16 @@  int i915_cmd_parser_init_ring(struct intel_engine_cs *ring)
 	default:
 		DRM_ERROR("CMD: cmd_parser_init with unknown ring: %d\n",
 			  ring->id);
-		BUG();
+		return -ENODEV;
 	}
 
-	BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count));
-	BUG_ON(!validate_regs_sorted(ring));
+	if (DRM_ERROR_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count),
+			 "command parser table is not sorted - required for bisetion searching\n"))
+		return -ENODEV;
+
+	if (DRM_ERROR_ON(!validate_regs_sorted(ring),
+			 "register lists are not sorted - required for bisection searching\n"))
+		return -ENODEV;
 
 	WARN_ON(!hash_empty(ring->cmd_hash));