* [PATCH libdrm] amdgpu: add error return value for finding bo by cpu mapping
@ 2018-08-30 8:50 Junwei Zhang
[not found] ` <1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Junwei Zhang @ 2018-08-30 8:50 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Junwei Zhang, christian.koenig-5C7GfCeVMHo
If nothing is found, error should be returned.
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
---
amdgpu/amdgpu_bo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 2f4f90f..3812c5e 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -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,
--
1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH libdrm] amdgpu: add error return value for finding bo by cpu mapping [not found] ` <1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org> @ 2018-08-30 8:54 ` Christian König 2018-08-30 8:57 ` Michel Dänzer 1 sibling, 0 replies; 4+ messages in thread From: Christian König @ 2018-08-30 8:54 UTC (permalink / raw) To: Junwei Zhang, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Am 30.08.2018 um 10:50 schrieb Junwei Zhang: > If nothing is found, error should be returned. > > Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> > --- > amdgpu/amdgpu_bo.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c > index 2f4f90f..3812c5e 100644 > --- a/amdgpu/amdgpu_bo.c > +++ b/amdgpu/amdgpu_bo.c > @@ -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. > > 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, _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH libdrm] amdgpu: add error return value for finding bo by cpu mapping [not found] ` <1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org> 2018-08-30 8:54 ` Christian König @ 2018-08-30 8:57 ` Michel Dänzer [not found] ` <01272587-1647-4456-57fa-ad809a100c34-otUistvHUpPR7s880joybQ@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: Michel Dänzer @ 2018-08-30 8:57 UTC (permalink / raw) To: Junwei Zhang; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On 2018-08-30 10:50 a.m., Junwei Zhang wrote: > If nothing is found, error should be returned. > > Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> > > [...] > > @@ -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, Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <01272587-1647-4456-57fa-ad809a100c34-otUistvHUpPR7s880joybQ@public.gmane.org>]
* Re: [PATCH libdrm] amdgpu: add error return value for finding bo by cpu mapping [not found] ` <01272587-1647-4456-57fa-ad809a100c34-otUistvHUpPR7s880joybQ@public.gmane.org> @ 2018-08-30 9:26 ` Zhang, Jerry (Junwei) 0 siblings, 0 replies; 4+ messages in thread From: Zhang, Jerry (Junwei) @ 2018-08-30 9:26 UTC (permalink / raw) To: Michel Dänzer; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On 08/30/2018 04:57 PM, Michel Dänzer wrote: > On 2018-08-30 10:50 a.m., Junwei Zhang wrote: >> If nothing is found, error should be returned. >> >> Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> >> >> [...] >> >> @@ -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. 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 > > With that, > > Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> > > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-30 9:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 8:50 [PATCH libdrm] amdgpu: add error return value for finding bo by cpu mapping Junwei Zhang
[not found] ` <1535619003-18067-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-30 8:54 ` Christian König
2018-08-30 8:57 ` Michel Dänzer
[not found] ` <01272587-1647-4456-57fa-ad809a100c34-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-08-30 9:26 ` Zhang, Jerry (Junwei)
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.