]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/xe/rtp: Allow to match 0 sr entries
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 18 Jun 2024 05:00:40 +0000 (22:00 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Tue, 18 Jun 2024 19:03:27 +0000 (12:03 -0700)
If none of the rules match, there should be 0 entries in the sr xarray,
so none of them should have a register matching.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240618050044.324454-2-lucas.demarchi@intel.com
drivers/gpu/drm/xe/tests/xe_rtp_test.c

index 06759d7547838f2d85a4d99647c30c46b1574b91..474a0b222ce164c61dc947800a8d4d8538001e05 100644 (file)
@@ -255,9 +255,14 @@ static void xe_rtp_process_tests(struct kunit *test)
        }
 
        KUNIT_EXPECT_EQ(test, count, param->expected_count);
-       KUNIT_EXPECT_EQ(test, sr_entry->clr_bits, param->expected_clr_bits);
-       KUNIT_EXPECT_EQ(test, sr_entry->set_bits, param->expected_set_bits);
-       KUNIT_EXPECT_EQ(test, sr_entry->reg.raw, param->expected_reg.raw);
+       if (count) {
+               KUNIT_EXPECT_EQ(test, sr_entry->clr_bits, param->expected_clr_bits);
+               KUNIT_EXPECT_EQ(test, sr_entry->set_bits, param->expected_set_bits);
+               KUNIT_EXPECT_EQ(test, sr_entry->reg.raw, param->expected_reg.raw);
+       } else {
+               KUNIT_EXPECT_NULL(test, sr_entry);
+       }
+
        KUNIT_EXPECT_EQ(test, reg_sr->errors, param->expected_sr_errors);
 }