]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdkfd: Use resource_size() helper function
authorDeepak R Varma <drv@mailo.com>
Thu, 22 Dec 2022 21:15:00 +0000 (02:45 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:27:50 +0000 (15:27 -0800)
[ Upstream commit 9d086e0ddaeb08876f4df3a1485166bfd7483252 ]

Use the resource_size() function instead of a open coded computation
resource size. It makes the code more readable.

Issue identified using resource_size.cocci coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Stable-dep-of: 02eed83abc13 ("drm/amdkfd: fixes for HMM mem allocation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

index 88bf6221d4befa6f9f932101005a5c2e386ce71f..2d011daf5a395336f42a16f802df28f5f4dfefef 100644 (file)
@@ -1038,8 +1038,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
                /* Disable SVM support capability */
                pgmap->type = 0;
                if (pgmap->type == MEMORY_DEVICE_PRIVATE)
-                       devm_release_mem_region(adev->dev, res->start,
-                                               res->end - res->start + 1);
+                       devm_release_mem_region(adev->dev, res->start, resource_size(res));
                return PTR_ERR(r);
        }