]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
DRM: handle pci_enable_device failure
authorJeff Garzik <jeff@garzik.org>
Fri, 8 Dec 2006 23:50:22 +0000 (10:50 +1100)
committerDave Airlie <airlied@linux.ie>
Mon, 11 Dec 2006 07:28:52 +0000 (18:28 +1100)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drm_stub.c

index 5fd6dc0870cf7b4d36c6b526fceca7e846e5096d..120d10256feb6d5371da2d3c9652f8e26ce73aa4 100644 (file)
@@ -211,14 +211,16 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
        if (!dev)
                return -ENOMEM;
 
-       pci_enable_device(pdev);
+       ret = pci_enable_device(pdev);
+       if (ret)
+               goto err_g1;
 
        if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
                printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
-               goto err_g1;
+               goto err_g2;
        }
        if ((ret = drm_get_head(dev, &dev->primary)))
-               goto err_g1;
+               goto err_g2;
        
        DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
                 driver->name, driver->major, driver->minor, driver->patchlevel,
@@ -226,7 +228,9 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 
        return 0;
 
-      err_g1:
+err_g2:
+       pci_disable_device(pdev);
+err_g1:
        drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
        return ret;
 }