All of lore.kernel.org
 help / color / mirror / Atom feed
From: Melissa Wen <melissa.srw@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/vgem: validate vgem_device before exit operations
Date: Thu, 17 Sep 2020 11:21:45 -0300	[thread overview]
Message-ID: <20200917142145.ipcxb2zo4up357t2@smtp.gmail.com> (raw)

This patch adds a check for the vgem_device before handling it.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index cb884c890065..119ca887cb8a 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -472,7 +472,14 @@ static int __init vgem_init(void)
 
 static void __exit vgem_exit(void)
 {
-	struct platform_device *pdev = vgem_device->platform;
+	struct platform_device *pdev;
+
+	if (!vgem_device) {
+		DRM_INFO("vgem_device is NULL\n");
+		return;
+	}
+
+	pdev = vgem_device->platform;
 
 	drm_dev_unregister(&vgem_device->drm);
 	devres_release_group(&pdev->dev, NULL);
-- 
2.28.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2020-09-17 14:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 14:21 Melissa Wen [this message]
2020-09-17 14:30 ` [PATCH] drm/vgem: validate vgem_device before exit operations Daniel Vetter
2020-09-17 14:39 ` Ruhl, Michael J

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=20200917142145.ipcxb2zo4up357t2@smtp.gmail.com \
    --to=melissa.srw@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.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 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.