Commit 3788f48a authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm: cleanup properly in drm_get_dev() failure paths

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 30ddbd94
...@@ -402,14 +402,14 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -402,14 +402,14 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
if (dev->driver->load) { if (dev->driver->load) {
ret = dev->driver->load(dev, ent->driver_data); ret = dev->driver->load(dev, ent->driver_data);
if (ret) if (ret)
goto err_g3; goto err_g4;
} }
/* setup the grouping for the legacy output */ /* setup the grouping for the legacy output */
if (drm_core_check_feature(dev, DRIVER_MODESET)) { if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group); ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
if (ret) if (ret)
goto err_g3; goto err_g4;
} }
list_add_tail(&dev->driver_item, &driver->device_list); list_add_tail(&dev->driver_item, &driver->device_list);
...@@ -420,8 +420,11 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -420,8 +420,11 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
return 0; return 0;
err_g3: err_g4:
drm_put_minor(&dev->primary); drm_put_minor(&dev->primary);
err_g3:
if (drm_core_check_feature(dev, DRIVER_MODESET))
drm_put_minor(&dev->control);
err_g2: err_g2:
pci_disable_device(pdev); pci_disable_device(pdev);
err_g1: err_g1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment