aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_bo.c
diff options
context:
space:
mode:
authorHong Liu <hong.liu@intel.com>2008-05-09 10:15:17 +0800
committerJesse Barnes <jbarnes@nietzche.virtuousgeek.org>2008-05-12 12:07:27 -0700
commitb2dee13f5d7209b62c5e9ba8cd059717a8302fec (patch)
treef117340a8f1cebb9efc8b87713511ebd9e7007b3 /linux-core/drm_bo.c
parentf1b9bbe2b8f2339359afa39bf27702eca6f6c975 (diff)
free dummy read page if fail to init mm
Since drm_bo_driver_init will be called in driver_load, we need to free what it alloced when error to avoid memory leak.
Diffstat (limited to 'linux-core/drm_bo.c')
-rw-r--r--linux-core/drm_bo.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 301f946f..0470825b 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -2406,8 +2406,14 @@ int drm_bo_driver_init(struct drm_device *dev)
* Other types need to be driver / IOCTL initialized.
*/
ret = drm_bo_init_mm(dev, DRM_BO_MEM_LOCAL, 0, 0, 1);
- if (ret)
+ if (ret) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
+ ClearPageReserved(bm->dummy_read_page);
+#endif
+ __free_page(bm->dummy_read_page);
+ bm->dummy_read_page = NULL;
goto out_unlock;
+ }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&bm->wq, &drm_bo_delayed_workqueue, dev);