Commit 616576df authored by Dan Carpenter's avatar Dan Carpenter Committed by Thomas Hellström

drm/xe/selftests: Fix an error pointer dereference bug

Check if "bo" is an error pointer before calling xe_bo_lock() on it.

Fixes: d6abc18d ("drm/xe/xe2: Modify xe_bo_test for system memory")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
(cherry picked from commit 88ec2352)
Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
parent ffd915e4
...@@ -125,14 +125,13 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, ...@@ -125,14 +125,13 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile,
bo = xe_bo_create_user(xe, NULL, NULL, SZ_1M, DRM_XE_GEM_CPU_CACHING_WC, bo = xe_bo_create_user(xe, NULL, NULL, SZ_1M, DRM_XE_GEM_CPU_CACHING_WC,
ttm_bo_type_device, bo_flags); ttm_bo_type_device, bo_flags);
xe_bo_lock(bo, false);
if (IS_ERR(bo)) { if (IS_ERR(bo)) {
KUNIT_FAIL(test, "Failed to create bo.\n"); KUNIT_FAIL(test, "Failed to create bo.\n");
return; return;
} }
xe_bo_lock(bo, false);
kunit_info(test, "Verifying that CCS data is cleared on creation.\n"); kunit_info(test, "Verifying that CCS data is cleared on creation.\n");
ret = ccs_test_migrate(tile, bo, false, 0ULL, 0xdeadbeefdeadbeefULL, ret = ccs_test_migrate(tile, bo, false, 0ULL, 0xdeadbeefdeadbeefULL,
test); test);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment