Only release irq resources if we were actually using them.
authorHasso Tepper <hasso@estpak.ee>
Tue, 23 Jun 2009 22:11:01 +0000 (01:11 +0300)
committerHasso Tepper <hasso@estpak.ee>
Wed, 24 Jun 2009 20:05:01 +0000 (23:05 +0300)
Obtained-from: FreeBSD

sys/dev/drm/drm_drv.c

index 24c7796..1342e5e 100644 (file)
@@ -263,15 +263,18 @@ int drm_detach(device_t kdev)
        dev = device_get_softc(kdev);
 
        drm_unload(dev);
-
-       bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
+       
+       if (dev->irqr) {
+               bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid,
+                   dev->irqr);
 
 #if 0
-       if (dev->msi_enabled) {
-               pci_release_msi(dev->device);
-               DRM_INFO("MSI released\n");
-       }
+               if (dev->msi_enabled) {
+                       pci_release_msi(dev->device);
+                       DRM_INFO("MSI released\n");
+               }
 #endif
+       }
 
        return 0;
 }