diff mbox series

drm/amdkfd: fix resource_size.cocci warnings

Message ID 1632640580-61609-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series drm/amdkfd: fix resource_size.cocci warnings | expand

Commit Message

Yang Li Sept. 26, 2021, 7:16 a.m. UTC
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(-)

Comments

Amos Jianjun Kong Sept. 26, 2021, 7:10 p.m. UTC | #1
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
>
>
Alex Deucher Sept. 27, 2021, 7:25 p.m. UTC | #2
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
>>
diff mbox series

Patch

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);
 	}