]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/nouveau: Skip vga_fini on non-PCI device
authorMikko Perttunen <mperttunen@nvidia.com>
Fri, 9 Jun 2017 12:25:41 +0000 (15:25 +0300)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 16 Jun 2017 04:05:04 +0000 (14:05 +1000)
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 <mperttunen@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_vga.c

index 02fe0efb9e1643f3a4802b947b3ab306bdd690bd..48393a4f633129550ee5de4ce0b09045392f7b2d 100644 (file)
@@ -111,6 +111,10 @@ nouveau_vga_fini(struct nouveau_drm *drm)
        struct drm_device *dev = drm->dev;
        bool runtime = nouveau_pmops_runtime();
 
+       /* only relevant for PCI devices */
+       if (!dev->pdev)
+               return;
+
        vga_client_register(dev->pdev, NULL, NULL, NULL);
 
        if (pci_is_thunderbolt_attached(dev->pdev))