msm: kgsl: Free allocated memory on early return

Make sure the allocated memory is freed before returning.

Change-Id: I6da7d1ffbd83ad206970e38ac99f9da211ffe86c
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
This commit is contained in:
Carter Cooper 2015-12-22 11:21:08 -07:00 committed by David Keitel
parent d362e25309
commit 4318bd3cd6

View file

@ -824,16 +824,16 @@ static int _set_pagetable_gpu(struct adreno_ringbuffer *rb,
int result;
link = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (link == NULL) {
result = -ENOMEM;
goto done;
}
if (link == NULL)
return -ENOMEM;
cmds = link;
/* If we are in a fault the MMU will be reset soon */
if (test_bit(ADRENO_DEVICE_FAULT, &adreno_dev->priv))
if (test_bit(ADRENO_DEVICE_FAULT, &adreno_dev->priv)) {
kfree(link);
return 0;
}
kgsl_mmu_enable_clk(&device->mmu);
@ -861,7 +861,6 @@ static int _set_pagetable_gpu(struct adreno_ringbuffer *rb,
adreno_ringbuffer_mmu_disable_clk_on_ts(device, rb,
rb->timestamp);
done:
kfree(link);
return result;
}