Date: Sun, 25 Aug 2013 00:22:34 +0000 (UTC) From: Jean-Sebastien Pedron <dumbbell@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254821 - head/sys/dev/drm2 Message-ID: <201308250022.r7P0MYEN076715@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dumbbell Date: Sun Aug 25 00:22:34 2013 New Revision: 254821 URL: http://svnweb.freebsd.org/changeset/base/254821 Log: drm: Fix cleanup if device initialization fails This plugs some memory leaks. Modified: head/sys/dev/drm2/drm_drv.c Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sun Aug 25 00:13:53 2013 (r254820) +++ head/sys/dev/drm2/drm_drv.c Sun Aug 25 00:22:34 2013 (r254821) @@ -313,8 +313,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); } @@ -572,7 +586,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", @@ -586,7 +600,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308250022.r7P0MYEN076715>