Skip to content

Commit

Permalink
drm/ttm: fix small memory leak in ttm_memory.c
Browse files Browse the repository at this point in the history
I moved the allocation until after the check for (si->totalhigh == 0).

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-By:  Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Dan Carpenter authored and Dave Airlie committed Dec 3, 2009
1 parent 1a95916 commit 46a79fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/ttm/ttm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,17 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob,
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;

Expand Down

0 comments on commit 46a79fa

Please sign in to comment.