I moved the allocation until after the check for (si->totalhigh == 0).

regards,
dan carpenter

Signed-off-by: Dan Carpenter <erro...@gmail.com>

--- orig/drivers/gpu/drm/ttm/ttm_memory.c       2009-11-28 07:05:54.000000000 
+0200
+++ devel/drivers/gpu/drm/ttm/ttm_memory.c      2009-11-28 07:07:52.000000000 
+0200
@@ -274,16 +274,17 @@ static int ttm_mem_init_kernel_zone(stru
 static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
                                     const struct sysinfo *si)
 {
-       struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL);
+       struct ttm_mem_zone *zone;
        uint64_t mem;
        int ret;
 
-       if (unlikely(!zone))
-               return -ENOMEM;
-
        if (si->totalhigh == 0)
                return 0;
 
+       zone = kzalloc(sizeof(*zone), GFP_KERNEL);
+       if (unlikely(!zone))
+               return -ENOMEM;
+
        mem = si->totalram;
        mem *= si->mem_unit;
 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to