[bug report] drm/amdgpu: add selftest framework for UMSCH

Dan Carpenter dan.carpenter at linaro.org
Wed Sep 6 09:39:46 UTC 2023


Hello Lang Yu,

The patch 5d5eac7e8303: "drm/amdgpu: add selftest framework for
UMSCH" from Jun 21, 2023 (linux-next), leads to the following Smatch
static checker warning:

	drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c:338 setup_umsch_mm_test()
	warn: unsigned error codes 'test->pasid'

drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c
    319 static int setup_umsch_mm_test(struct amdgpu_device *adev,
    320                           struct umsch_mm_test *test)
    321 {
    322         struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
    323         int r;
    324 
    325         test->vm_cntx_cntl = hub->vm_cntx_cntl;
    326 
    327         test->vm = kzalloc(sizeof(*test->vm), GFP_KERNEL);
    328         if (!test->vm) {
    329                 r = -ENOMEM;
    330                 return r;
    331         }
    332 
    333         r = amdgpu_vm_init(adev, test->vm, -1);
    334         if (r)
    335                 goto error_free_vm;
    336 
    337         test->pasid = amdgpu_pasid_alloc(16);
--> 338         if (test->pasid < 0) {
                    ^^^^^^^^^^^^^^^
Unsigned can't be less than zero.

    339                 r = test->pasid;
    340                 goto error_fini_vm;
    341         }
    342 
    343         r = amdgpu_bo_create_kernel(adev, sizeof(struct umsch_mm_test_ctx_data),

regards,
dan carpenter


More information about the amd-gfx mailing list