From patchwork Fri Jun 9 12:25:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Perttunen X-Patchwork-Id: 9778363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F4B06034B for ; Fri, 9 Jun 2017 12:26:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 301DF28421 for ; Fri, 9 Jun 2017 12:26:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24FDB2860C; Fri, 9 Jun 2017 12:26:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE8D728421 for ; Fri, 9 Jun 2017 12:26:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36A0089142; Fri, 9 Jun 2017 12:26:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:1bc8:1004::1:25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90CD86E5E0 for ; Fri, 9 Jun 2017 12:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=kO+rS0+m3kxAC90uWHCLh+Iu8mnwi7ACPIG1IcfvDtY=; b=kF4NlXRwQdGN+lBPCU6RyOIY9e5EtXBcK7bumqB89x/gf8hDc1L9ya6ItZLRbFmY0achQ93enFsvmk4EebF+/6jGSysvEl0A7G7MRZdj+B8V0jGXsVwXejv9G0OvHOoW7yyAO091qjSdkFXnettpfreYph7wH9nxXf7pAQtc7C/+75o9JMPQeS6S7C65fYPktC7816ekZn/282OLIQMKk91fJwji8+BtnKb8EhmTIyaQahI1wsiZDmeRmumfD31e8VABpVSFsO0FMZ9DBLdTyRWI75dLKt0Vv/Dly075SkMvqBZZalUQsHIEQuYgFYFSvcTrRsVAxpW70KlyuLnmLA==; Received: from dsl-espbrasgw1-54f9c1-183.dhcp.inet.fi ([84.249.193.183] helo=toshino.dhcp.inet.fi) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1dJIzJ-0002Vp-3Q; Fri, 09 Jun 2017 15:26:01 +0300 From: Mikko Perttunen To: bskeggs@redhat.com, nouveau@lists.freedesktop.org Subject: [PATCH 3/3] drm/nouveau: Skip vga_fini on non-PCI device Date: Fri, 9 Jun 2017 15:25:41 +0300 Message-Id: <20170609122541.31118-3-mperttunen@nvidia.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170609122541.31118-1-mperttunen@nvidia.com> References: <20170609122541.31118-1-mperttunen@nvidia.com> X-SA-Exim-Connect-IP: 84.249.193.183 X-SA-Exim-Mail-From: mperttunen@nvidia.COM X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Cc: dri-devel@lists.freedesktop.org, Mikko Perttunen , kholtta@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org, jonathanh@nvidia.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP As with vga_init, this function doesn't make sense on non-PCI devices, and the Thunderbolt check in it dereferences a NULL pointer in that case. Add some code to skip this function when the device is not a PCI device. Signed-off-by: Mikko Perttunen --- drivers/gpu/drm/nouveau/nouveau_vga.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index a4aacbc0cec8..b19dd4dc7099 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c @@ -115,6 +115,10 @@ nouveau_vga_fini(struct nouveau_drm *drm) struct drm_device *dev = drm->dev; bool runtime = false; + /* only relevant for PCI devices */ + if (!dev->pdev) + return; + vga_client_register(dev->pdev, NULL, NULL, NULL); if (pci_is_thunderbolt_attached(dev->pdev))