AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/4] drm/amdkfd: Add NULL-pointer check
Date: Wed, 21 Nov 2018 03:07:27 +0000	[thread overview]
Message-ID: <1542769636-2976-3-git-send-email-Felix.Kuehling@amd.com> (raw)
In-Reply-To: <1542769636-2976-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

top_dev->gpu is NULL for CPUs. Avoid dereferencing it if NULL.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index aa793fc..c5ed21e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -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;
 		}
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-11-21  3:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21  3:07 [PATCH 0/4] KFD upstreaming Nov 2018, part 2 Kuehling, Felix
     [not found] ` <1542769636-2976-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-11-21  3:07   ` [PATCH 1/4] drm/amdgpu: Add KFD VRAM limit checking Kuehling, Felix
2018-11-21  3:07   ` [PATCH 3/4] drm/amdkfd: Add DMABuf import functionality Kuehling, Felix
2018-11-21  3:07   ` Kuehling, Felix [this message]
2018-11-21  3:07   ` [PATCH 4/4] drm/amdkfd: Add support for doorbell BOs Kuehling, Felix
2018-12-04  0:05   ` [PATCH 0/4] KFD upstreaming Nov 2018, part 2 Kuehling, Felix
     [not found]     ` <f866486f-991d-466d-6594-9e16a8526b71-5C7GfCeVMHo@public.gmane.org>
2018-12-04 15:13       ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1542769636-2976-3-git-send-email-Felix.Kuehling@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox