Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

The shmem_pin_map() function doesn't return error pointers, it returns
NULL.

Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the default context state")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220708094104.GL2316@kadam

authored by

Dan Carpenter and committed by
Matthew Auld
d50f5a10 78353039

+4 -4
+4 -4
drivers/gpu/drm/i915/gt/selftest_lrc.c
··· 176 176 continue; 177 177 178 178 hw = shmem_pin_map(engine->default_state); 179 - if (IS_ERR(hw)) { 180 - err = PTR_ERR(hw); 179 + if (!hw) { 180 + err = -ENOMEM; 181 181 break; 182 182 } 183 183 hw += LRC_STATE_OFFSET / sizeof(*hw); ··· 365 365 continue; 366 366 367 367 hw = shmem_pin_map(engine->default_state); 368 - if (IS_ERR(hw)) { 369 - err = PTR_ERR(hw); 368 + if (!hw) { 369 + err = -ENOMEM; 370 370 break; 371 371 } 372 372 hw += LRC_STATE_OFFSET / sizeof(*hw);