diff --git a/drivers/gpu/msm/adreno_iommu.c b/drivers/gpu/msm/adreno_iommu.c index 45f5c9be64d9..ba240190f98b 100644 --- a/drivers/gpu/msm/adreno_iommu.c +++ b/drivers/gpu/msm/adreno_iommu.c @@ -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; }