svn commit: r261659 - stable/9/sys/dev/drm2
Jean-Sebastien Pedron
dumbbell at FreeBSD.org
Sun Feb 9 15:17:58 UTC 2014
Author: dumbbell
Date: Sun Feb 9 15:17:57 2014
New Revision: 261659
URL: http://svnweb.freebsd.org/changeset/base/261659
Log:
MFC r254821:
drm: Fix cleanup if device initialization fails
This plugs some memory leaks.
Modified:
stable/9/sys/dev/drm2/drm_drv.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/dev/ (props changed)
Modified: stable/9/sys/dev/drm2/drm_drv.c
==============================================================================
--- stable/9/sys/dev/drm2/drm_drv.c Sun Feb 9 14:58:47 2014 (r261658)
+++ stable/9/sys/dev/drm2/drm_drv.c Sun Feb 9 15:17:57 2014 (r261659)
@@ -311,8 +311,22 @@ int drm_attach(device_t kdev, drm_pci_id
sx_init(&dev->dev_struct_lock, "drmslk");
error = drm_load(dev);
- if (error == 0)
- error = drm_create_cdevs(kdev);
+ if (error)
+ goto error;
+
+ error = drm_create_cdevs(kdev);
+ if (error)
+ goto error;
+
+ return (error);
+error:
+ if (dev->irqr) {
+ bus_release_resource(dev->device, SYS_RES_IRQ,
+ dev->irqrid, dev->irqr);
+ }
+ if (dev->msi_enabled) {
+ pci_release_msi(dev->device);
+ }
return (error);
}
@@ -570,7 +584,7 @@ static int drm_load(struct drm_device *d
DRM_ERROR("Request to enable bus-master failed.\n");
DRM_UNLOCK(dev);
if (retcode != 0)
- goto error;
+ goto error1;
}
DRM_INFO("Initialized %s %d.%d.%d %s\n",
@@ -584,7 +598,9 @@ static int drm_load(struct drm_device *d
error1:
delete_unrhdr(dev->drw_unrhdr);
+ drm_gem_destroy(dev);
error:
+ drm_ctxbitmap_cleanup(dev);
drm_sysctl_cleanup(dev);
DRM_LOCK(dev);
drm_lastclose(dev);
More information about the svn-src-stable-9
mailing list