Skip to content

Commit 2403d1c

Browse files
Mirsad Todorovacmehmetb0
Mirsad Todorovac
authored andcommitted
drm/xe: fix the ERR_PTR() returned on failure to allocate tiny pt
BugLink: https://bugs.launchpad.net/bugs/2097332 [ Upstream commit ed69b28 ] Running coccinelle spatch gave the following warning: ./drivers/gpu/drm/xe/tests/xe_migrate.c:226:5-11: inconsistent IS_ERR and PTR_ERR on line 228. The code reports PTR_ERR(pt) when IS_ERR(tiny) is checked: → 211 pt = xe_bo_create_pin_map(xe, tile, m->q->vm, XE_PAGE_SIZE, 212 ttm_bo_type_kernel, 213 XE_BO_FLAG_VRAM_IF_DGFX(tile) | 214 XE_BO_FLAG_PINNED); 215 if (IS_ERR(pt)) { 216 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n", 217 PTR_ERR(pt)); 218 goto free_big; 219 } 220 221 tiny = xe_bo_create_pin_map(xe, tile, m->q->vm, → 222 2 * SZ_4K, 223 ttm_bo_type_kernel, 224 XE_BO_FLAG_VRAM_IF_DGFX(tile) | 225 XE_BO_FLAG_PINNED); → 226 if (IS_ERR(tiny)) { → 227 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n", → 228 PTR_ERR(pt)); 229 goto free_pt; 230 } Now, the IS_ERR(tiny) and the corresponding PTR_ERR(pt) do not match. Returning PTR_ERR(tiny), as the last failed function call, seems logical. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Mirsad Todorovac <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]> (cherry picked from commit cb57c75) Signed-off-by: Thomas Hellström <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Koichiro Den <[email protected]>
1 parent b6170fa commit 2403d1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/xe/tests/xe_migrate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
223223
XE_BO_FLAG_VRAM_IF_DGFX(tile) |
224224
XE_BO_FLAG_PINNED);
225225
if (IS_ERR(tiny)) {
226-
KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
227-
PTR_ERR(pt));
226+
KUNIT_FAIL(test, "Failed to allocate tiny fake pt: %li\n",
227+
PTR_ERR(tiny));
228228
goto free_pt;
229229
}
230230

0 commit comments

Comments
 (0)