]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdkfd: Add NULL-pointer check
authorFelix Kuehling <Felix.Kuehling@amd.com>
Wed, 21 Nov 2018 01:52:37 +0000 (20:52 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 7 Dec 2018 23:13:48 +0000 (18:13 -0500)
top_dev->gpu is NULL for CPUs. Avoid dereferencing it if NULL.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_topology.c

index aa793fcbbdcc23dd5d473f0f4ee96444ea429e36..c5ed21ef246219b805db56641d65b5a7ec6d5734 100644 (file)
@@ -101,7 +101,7 @@ struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev)
        down_read(&topology_lock);
 
        list_for_each_entry(top_dev, &topology_device_list, list)
-               if (top_dev->gpu->pdev == pdev) {
+               if (top_dev->gpu && top_dev->gpu->pdev == pdev) {
                        device = top_dev->gpu;
                        break;
                }