DRM: handle pci_enable_device failure
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
parent
94f060bd0f
commit
2c3f0eddfb
|
@ -211,14 +211,16 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENOMEM;
|
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))) {
|
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
|
||||||
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
|
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
|
||||||
goto err_g1;
|
goto err_g2;
|
||||||
}
|
}
|
||||||
if ((ret = drm_get_head(dev, &dev->primary)))
|
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",
|
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
|
||||||
driver->name, driver->major, driver->minor, driver->patchlevel,
|
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;
|
return 0;
|
||||||
|
|
||||||
err_g1:
|
err_g2:
|
||||||
|
pci_disable_device(pdev);
|
||||||
|
err_g1:
|
||||||
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
|
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue