drivers/gpu/drm/xe/tests/xe_migrate.c:224 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
From: Dan Carpenter
Date: Tue Jan 30 2024 - 00:12:17 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
commit: dd08ebf6c3525a7ea2186e636df064ea47281987 drm/xe: Introduce a new DRM driver for Intel GPUs
config: sparc-randconfig-r081-20240128 (https://download.01.org/0day-ci/archive/20240129/202401292346.V7E6rEzz-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202401292346.V7E6rEzz-lkp@xxxxxxxxx/
New smatch warnings:
drivers/gpu/drm/xe/tests/xe_migrate.c:224 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
Old smatch warnings:
drivers/gpu/drm/xe/tests/xe_migrate.c:254 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +224 drivers/gpu/drm/xe/tests/xe_migrate.c
dd08ebf6c3525a Matthew Brost 2023-03-30 210 static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
dd08ebf6c3525a Matthew Brost 2023-03-30 211 {
dd08ebf6c3525a Matthew Brost 2023-03-30 212 struct xe_gt *gt = m->gt;
dd08ebf6c3525a Matthew Brost 2023-03-30 213 struct xe_device *xe = gt_to_xe(gt);
dd08ebf6c3525a Matthew Brost 2023-03-30 214 struct xe_bo *pt, *bo = m->pt_bo, *big, *tiny;
dd08ebf6c3525a Matthew Brost 2023-03-30 215 struct xe_res_cursor src_it;
dd08ebf6c3525a Matthew Brost 2023-03-30 216 struct dma_fence *fence;
dd08ebf6c3525a Matthew Brost 2023-03-30 217 u64 retval, expected;
dd08ebf6c3525a Matthew Brost 2023-03-30 218 struct xe_bb *bb;
dd08ebf6c3525a Matthew Brost 2023-03-30 219 int err;
dd08ebf6c3525a Matthew Brost 2023-03-30 220 u8 id = gt->info.id;
dd08ebf6c3525a Matthew Brost 2023-03-30 221
dd08ebf6c3525a Matthew Brost 2023-03-30 222 err = xe_bo_vmap(bo);
dd08ebf6c3525a Matthew Brost 2023-03-30 223 if (err) {
dd08ebf6c3525a Matthew Brost 2023-03-30 @224 KUNIT_FAIL(test, "Failed to vmap our pagetables: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 225 PTR_ERR(bo));
^^^^^^^^^^^
This should be "err".
dd08ebf6c3525a Matthew Brost 2023-03-30 226 return;
dd08ebf6c3525a Matthew Brost 2023-03-30 227 }
dd08ebf6c3525a Matthew Brost 2023-03-30 228
dd08ebf6c3525a Matthew Brost 2023-03-30 229 big = xe_bo_create_pin_map(xe, m->gt, m->eng->vm, SZ_4M,
dd08ebf6c3525a Matthew Brost 2023-03-30 230 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 231 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 232 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 233 if (IS_ERR(big)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 234 KUNIT_FAIL(test, "Failed to allocate bo: %li\n", PTR_ERR(big));
dd08ebf6c3525a Matthew Brost 2023-03-30 235 goto vunmap;
dd08ebf6c3525a Matthew Brost 2023-03-30 236 }
dd08ebf6c3525a Matthew Brost 2023-03-30 237
dd08ebf6c3525a Matthew Brost 2023-03-30 238 pt = xe_bo_create_pin_map(xe, m->gt, m->eng->vm, GEN8_PAGE_SIZE,
dd08ebf6c3525a Matthew Brost 2023-03-30 239 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 240 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 241 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 242 if (IS_ERR(pt)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 243 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 244 PTR_ERR(pt));
dd08ebf6c3525a Matthew Brost 2023-03-30 245 goto free_big;
dd08ebf6c3525a Matthew Brost 2023-03-30 246 }
dd08ebf6c3525a Matthew Brost 2023-03-30 247
dd08ebf6c3525a Matthew Brost 2023-03-30 248 tiny = xe_bo_create_pin_map(xe, m->gt, m->eng->vm,
dd08ebf6c3525a Matthew Brost 2023-03-30 249 2 * SZ_4K,
dd08ebf6c3525a Matthew Brost 2023-03-30 250 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 251 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 252 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 253 if (IS_ERR(tiny)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 254 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 255 PTR_ERR(pt));
^^^^^^^^^^^
s/pt/tiny/
dd08ebf6c3525a Matthew Brost 2023-03-30 256 goto free_pt;
dd08ebf6c3525a Matthew Brost 2023-03-30 257 }
dd08ebf6c3525a Matthew Brost 2023-03-30 258
dd08ebf6c3525a Matthew Brost 2023-03-30 259 bb = xe_bb_new(m->gt, 32, xe->info.supports_usm);
dd08ebf6c3525a Matthew Brost 2023-03-30 260 if (IS_ERR(bb)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 261 KUNIT_FAIL(test, "Failed to create batchbuffer: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 262 PTR_ERR(bb));
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki