amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: fix resource_size.cocci warnings
@ 2021-09-26  7:16 Yang Li
  2021-09-26 19:10 ` Amos Jianjun Kong
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Li @ 2021-09-26  7:16 UTC (permalink / raw)
  To: airlied
  Cc: daniel, Felix.Kuehling, alexander.deucher, christian.koenig,
	amd-gfx, dri-devel, linux-kernel, Yang Li

Use resource_size function on resource object
instead of explicit computation.

Clean up coccicheck warning:
./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:905:10-13: ERROR: Missing
resource_size with res

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
index 4a16e3c..f53e17a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -901,8 +901,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
 
 		/* Disable SVM support capability */
 		pgmap->type = 0;
-		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);
 	}
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: fix resource_size.cocci warnings
  2021-09-26  7:16 [PATCH] drm/amdkfd: fix resource_size.cocci warnings Yang Li
@ 2021-09-26 19:10 ` Amos Jianjun Kong
  2021-09-27 19:25   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Amos Jianjun Kong @ 2021-09-26 19:10 UTC (permalink / raw)
  To: Yang Li
  Cc: airlied, daniel, Felix.Kuehling, alexander.deucher,
	christian.koenig, amd-gfx, dri-devel, open list

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

On Sun, Sep 26, 2021 at 3:17 PM Yang Li <yang.lee@linux.alibaba.com> wrote:

> Use resource_size function on resource object
> instead of explicit computation.
>
> Clean up coccicheck warning:
> ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:905:10-13: ERROR: Missing
> resource_size with res
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 4a16e3c..f53e17a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -901,8 +901,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
>
>                 /* Disable SVM support capability */
>                 pgmap->type = 0;
> -               devm_release_mem_region(adev->dev, res->start,
> -                                       res->end - res->start + 1);
> +               devm_release_mem_region(adev->dev, res->start,
> resource_size(res));
>

Looks good.
Reviewed-by: Amos Kong <kongjianjun@gmail.com>



>                 return PTR_ERR(r);
>         }
>
> --
> 1.8.3.1
>
>

[-- Attachment #2: Type: text/html, Size: 2080 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: fix resource_size.cocci warnings
  2021-09-26 19:10 ` Amos Jianjun Kong
@ 2021-09-27 19:25   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-09-27 19:25 UTC (permalink / raw)
  To: Amos Jianjun Kong
  Cc: Yang Li, Dave Airlie, Daniel Vetter, Kuehling, Felix, Deucher,
	Alexander, Christian Koenig, amd-gfx list,
	Maling list - DRI developers, open list

Applied.  Thanks!

Alex

On Sun, Sep 26, 2021 at 3:10 PM Amos Jianjun Kong <kongjianjun@gmail.com> wrote:
>
> On Sun, Sep 26, 2021 at 3:17 PM Yang Li <yang.lee@linux.alibaba.com> wrote:
>>
>> Use resource_size function on resource object
>> instead of explicit computation.
>>
>> Clean up coccicheck warning:
>> ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:905:10-13: ERROR: Missing
>> resource_size with res
>>
>> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
>> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
>> ---
>>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> index 4a16e3c..f53e17a 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> @@ -901,8 +901,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
>>
>>                 /* Disable SVM support capability */
>>                 pgmap->type = 0;
>> -               devm_release_mem_region(adev->dev, res->start,
>> -                                       res->end - res->start + 1);
>> +               devm_release_mem_region(adev->dev, res->start, resource_size(res));
>
>
> Looks good.
> Reviewed-by: Amos Kong <kongjianjun@gmail.com>
>
>
>>
>>                 return PTR_ERR(r);
>>         }
>>
>> --
>> 1.8.3.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-27 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  7:16 [PATCH] drm/amdkfd: fix resource_size.cocci warnings Yang Li
2021-09-26 19:10 ` Amos Jianjun Kong
2021-09-27 19:25   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).