drm: cleanup properly in drm_get_dev() failure paths
authorBen Skeggs <bskeggs@redhat.com>
Mon, 2 Mar 2009 00:37:44 +0000 (10:37 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 24 Apr 2009 05:09:25 +0000 (15:09 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_stub.c

index e8c2fd4c5e6565db789b5adf6e0954dc8485d12a..b9631e3a1ea69f421177cfead3e1c2ce3be9993b 100644 (file)
@@ -402,14 +402,14 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
        if (dev->driver->load) {
                ret = dev->driver->load(dev, ent->driver_data);
                if (ret)
-                       goto err_g3;
+                       goto err_g4;
        }
 
         /* setup the grouping for the legacy output */
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
                ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
                if (ret)
-                       goto err_g3;
+                       goto err_g4;
        }
 
        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,
 
        return 0;
 
-err_g3:
+err_g4:
        drm_put_minor(&dev->primary);
+err_g3:
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               drm_put_minor(&dev->control);
 err_g2:
        pci_disable_device(pdev);
 err_g1: