]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau: Do not try to disable PCI device on Tegra
authorThierry Reding <treding@nvidia.com>
Mon, 9 Dec 2019 12:00:00 +0000 (13:00 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 15 Jan 2020 00:49:58 +0000 (10:49 +1000)
When Nouveau is instantiated on top of a platform device, the dev->pdev
field will be NULL and calling pci_disable_device() will crash. Move the
PCI disabling code to the PCI specific driver removal code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_drm.c

index 2cd83849600f34b2ff22ca9990af042e4ad8a16b..b65ae817eabf5fde0d178fb96f759b28d2dd2692 100644 (file)
@@ -715,7 +715,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 void
 nouveau_drm_device_remove(struct drm_device *dev)
 {
-       struct pci_dev *pdev = dev->pdev;
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct nvkm_client *client;
        struct nvkm_device *device;
@@ -727,7 +726,6 @@ nouveau_drm_device_remove(struct drm_device *dev)
        device = nvkm_device_find(client->device);
 
        nouveau_drm_device_fini(dev);
-       pci_disable_device(pdev);
        drm_dev_put(dev);
        nvkm_device_del(&device);
 }
@@ -738,6 +736,7 @@ nouveau_drm_remove(struct pci_dev *pdev)
        struct drm_device *dev = pci_get_drvdata(pdev);
 
        nouveau_drm_device_remove(dev);
+       pci_disable_device(pdev);
 }
 
 static int