It doesn't really makes sense to dereference the kfd_process pointer
then check if its null right after, the order of the instructions has
been changed to address this and properly check for a null pointer.

Signed-off-by: Sunday Clement <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 041237861107..d581213b9422 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -3158,11 +3158,11 @@ static int kfd_ioctl_create_process(struct file *filep, 
struct kfd_process *p, v
        struct kfd_process *process;
        int ret;
 
-       /* Each FD owns only one kfd_process */
-       if (p->context_id != KFD_CONTEXT_ID_PRIMARY)
+       if (!filep->private_data || !p)
                return -EINVAL;
 
-       if (!filep->private_data || !p)
+       /* Each FD owns only one kfd_process */
+       if (p->context_id != KFD_CONTEXT_ID_PRIMARY)
                return -EINVAL;
 
        mutex_lock(&kfd_processes_mutex);
-- 
2.43.0

Reply via email to