diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c index dfb15d81d799..642f6e090ad0 100644 --- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c +++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c @@ -209,8 +209,7 @@ static const struct rtp_rules_test_case rtp_rules_cases[] = { { .name = "yes-or", .expected_match = true, - /* FIXME: The parser should raise an error here. */ - .expected_err = 0, + .expected_err = -EINVAL, XE_RTP_RULES(FUNC(match_yes), OR), }, { @@ -228,8 +227,7 @@ static const struct rtp_rules_test_case rtp_rules_cases[] = { { .name = "yes-or-or-no", .expected_match = true, - /* FIXME: The parser should raise an error here. */ - .expected_err = 0, + .expected_err = -EINVAL, XE_RTP_RULES(FUNC(match_yes), OR, OR, FUNC(match_no)), }, { diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c index c49f80f398af..976a2e1f5592 100644 --- a/drivers/gpu/drm/xe/xe_rtp.c +++ b/drivers/gpu/drm/xe/xe_rtp.c @@ -129,6 +129,7 @@ static bool rule_matches_with_err(const struct xe_device *xe, { const struct xe_rtp_rule *r; unsigned int i, rcount = 0; + bool short_circuit_or = false; if (err) *err = 0; @@ -143,13 +144,16 @@ static bool rule_matches_with_err(const struct xe_device *xe, /* * This is only reached if a complete conjunction of - * rules passed, in which case we shortcut the other - * rules and return true. + * rules passed, in which case we short-circuit rule + * evaluation, but still keep parsing to find any syntax + * errors. */ - return true; + short_circuit_or = true; + rcount = 0; + continue; } - if (rule_match_item(xe, gt, hwe, r)) { + if (short_circuit_or || rule_match_item(xe, gt, hwe, r)) { rcount++; } else { /* @@ -166,16 +170,12 @@ static bool rule_matches_with_err(const struct xe_device *xe, } } - if (drm_WARN_ON(&xe->drm, !rcount)) - goto error; + if (drm_WARN_ON(&xe->drm, !rcount)) { + if (err) + *err = -EINVAL; + } - return true; - -error: - if (err) - *err = -EINVAL; - - return false; + return short_circuit_or || rcount; } static bool rule_matches(const struct xe_device *xe,