提交 46a79fa0 编写于 作者: D Dan Carpenter 提交者: Dave Airlie

drm/ttm: fix small memory leak in ttm_memory.c

I moved the allocation until after the check for (si->totalhigh == 0).
Signed-off-by: NDan Carpenter <error27@gmail.com>
Acked-By: NThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 1a95916f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册