From d85e243259259d7702db0d344ae1ff7d26598227 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Fri, 30 Mar 2007 12:23:22 +0200
Subject: Fix an oops when trying to clean a not yet initialized memory type.

---
 linux-core/drm_bo.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 1bdc6fef..cea6ef62 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1991,10 +1991,16 @@ static int drm_bo_lock_mm(drm_device_t * dev, unsigned mem_type)
 	drm_mem_type_manager_t *man = &bm->man[mem_type];
 
 	if (mem_type == 0 || mem_type >= DRM_BO_MEM_TYPES) {
-		DRM_ERROR("Illegal memory manager memory type %u,\n", mem_type);
+		DRM_ERROR("Illegal memory manager memory type %u.\n", mem_type);
 		return -EINVAL;
 	}
 
+	if (!man->has_type) {
+		DRM_ERROR("Memory type %u has not been initialized.\n",
+			  mem_type);
+		return 0;
+	}
+
 	drm_bo_clean_unfenced(dev);
 	ret = drm_bo_force_list_clean(dev, &man->lru, mem_type, 0, 1, 0);
 	if (ret)
-- 
cgit v1.2.3