amdgpu: add error return value for finding bo by cpu mapping
PATCH 1/1 amdgpu: add error return value for finding bo by cpu mapping
If nothing is found, error should be returned.
--- amdgpu/amdgpu_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
amdgpu/amdgpu_bo.c +3 -1
@@ -550,6 +550,7 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, uint64_t *offset_in_bo) {uint32_t i; +int r =0 ;struct amdgpu_bo *bo;if (cpu ==NULL || size ==0 )
@@ -577,10 +578,11 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, }else { *buf_handle =NULL ; *offset_in_bo =0 ; + r = -EINVAL ; }pthread_mutex_unlock (&dev->bo_table_mutex); -return 0 ; +return r; } int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org
Christian König
Reviewed-byAm 30.08.2018 um 10:50 schrieb Junwei Zhang:
Quoted 3 lines
If nothing is found, error should be returned.
Signed-off-by Junwei Zhang <[email protected]>
Quoted 9 lines
--- amdgpu/amdgpu_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)amdgpu/amdgpu_bo.c +0
-0
amdgpu/amdgpu_bo.c int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, · line 554
Quoted 5 lines
amdgpu/amdgpu_bo.c +1
-0@@ -550,6 +550,7 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, uint64_t *offset_in_bo) {uint32_t i; +int r =0 ;struct amdgpu_bo *bo;
BTW: Kernel coding style usually uses reverse xmas tree for variables.
E.g. longest line first and variable like "i" or "r" last.
But not a big issue,
Christian.
Quoted 5 lines
amdgpu/amdgpu_bo.c +0
-0if (cpu ==NULL || size ==0 )@@ -577,10 +578,11 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, }else { *buf_handle =NULL ;
amdgpu/amdgpu_bo.c int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, · line 588
Quoted 10 lines
amdgpu/amdgpu_bo.c +2
-1*offset_in_bo =0 ; + r = -EINVAL ; }pthread_mutex_unlock (&dev->bo_table_mutex); -return 0 ; +return r; } int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Michel Dänzer
Reviewed-byamdgpu/amdgpu_bo.c int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, · line 581
Quoted 11 lines · Junwei Zhang
If nothing is found, error should be returned.
Signed-off-by Junwei Zhang <[email protected]>[...]
amdgpu/amdgpu_bo.c +1
-0@@ -577,10 +578,11 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, }else { *buf_handle =NULL ; *offset_in_bo =0 ; + r = -EINVAL ;
I think -ENOENT would be better, to differentiate this error from passing invalid pointer / size parameters.
With that,
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 01272587-1647-4456-57fa-ad809a100c34-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 7 lines · Michel Dänzer
Quoted 6 lines · Junwei Zhang
If nothing is found, error should be returned.
Signed-off-by Junwei Zhang <[email protected]>[...]
Quoted 8 lines
amdgpu/amdgpu_bo.c int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, · line 581
Quoted 5 lines
amdgpu/amdgpu_bo.c +1
-0@@ -577,10 +578,11 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, }else { *buf_handle =NULL ; *offset_in_bo =0 ; + r = -EINVAL ;I think
-ENOENTwould be better, to differentiate this error from passing invalid pointer / size parameters.
Mmm, good point, perhaps ENXIO is better,
which is used in amdgpu ttm for address out of existing range.
#define ENOENT 2 /* No such file or directory */ #define ENXIO 6 /* No such device or address */
Regards,
Jerry
Quoted 6 lines
With that,
Reviewed-by Michel Dänzer <[email protected]>
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx