nvk/mme: Add missing nullcheck in nvk_mme_test_state_state

Needed for some FSR macro changes I want to test.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 7d6cc15ab8 ("nvk/mme: Add a unit test framework for driver macros")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
(cherry picked from commit 32895657b4)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40488>
This commit is contained in:
Mary Guillemard 2026-03-10 08:55:23 +01:00 committed by Eric Engestrom
parent 3acc53d7a4
commit 4a90af4a3b
2 changed files with 6 additions and 4 deletions

View file

@ -814,7 +814,7 @@
"description": "nvk/mme: Add missing nullcheck in nvk_mme_test_state_state",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "7d6cc15ab81178be7660a27b26626734773c267f",
"notes": null

View file

@ -79,9 +79,11 @@ nvk_mme_test_state_state(void *_ts, uint16_t addr)
/* First, look backwards through the expected data that we've already
* written. This ensures that mthd() impacts state().
*/
for (int32_t i = ts->ei - 1; i >= 0; i--) {
if (ts->test->expected[i].mthd == addr)
return ts->test->expected[i].data;
if (ts->test->expected != NULL) {
for (int32_t i = ts->ei - 1; i >= 0; i--) {
if (ts->test->expected[i].mthd == addr)
return ts->test->expected[i].data;
}
}
/* Now look at init. We assume the init data is unique */