[PATCH 4/7] drm/amdkfd: Make kfd_lookup_process_by_pasid() well defined
Edward O'Callaghan
funfunctor at folklore1984.net
Sat Sep 10 01:31:36 UTC 2016
Ensure we return a NULL on the fail branch so that the call
site may BUG_ON() it.
Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 4f3849a..8d78052 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -481,13 +481,14 @@ bool kfd_has_process_device_data(struct kfd_process *p)
/* This returns with process->mutex locked. */
struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid)
{
- struct kfd_process *p;
+ struct kfd_process *p, *ret_p = NULL;
unsigned int temp;
int idx = srcu_read_lock(&kfd_processes_srcu);
hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
if (p->pasid == pasid) {
+ ret_p = p;
mutex_lock(&p->mutex);
break;
}
@@ -495,5 +496,5 @@ struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid)
srcu_read_unlock(&kfd_processes_srcu, idx);
- return p;
+ return ret_p;
}
--
2.7.4
More information about the amd-gfx
mailing list