Skip to contentSkip to conversation

drm/amdkfd: Use resource_size() helper function

PATCH Applied Deepak R Varma 2 participants 3 messages Dec 22, 2022 – Jan 9, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Use resource_size() helper function

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.

---
Note: Proposed change compile tested only.

 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +1 -2
index 10048ce16aea..de8ce72344fc 100644
@@ -1027,8 +1027,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);
 	}
 

--
2.34.1

#1 lore raw
Quoted 7 lines · Deepak R Varma

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.

---

Hello,
Requesting a review and feedback on this patch proposal?

Thank you,
./drv

maintainer Applied
#2 lore raw

Am 2023-01-07 um 15:09 schrieb Deepak R Varma:

Quoted 10 lines · Deepak R Varma
Quoted 7 lines

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.

---

Hello,
Requesting a review and feedback on this patch proposal?

I applied the patch to amd-staging-drm-next.

Thanks,
  Felix

Quoted 6 lines

Thank you,
./drv