summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/panfrost/panfrost_mmu.c
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2019-08-14 04:48:14 +0000
committerRob Herring <robh@kernel.org>2019-08-19 11:32:40 -0500
commit3efdf83ca0f9d3149f8c2201dad86a74fd952f91 (patch)
tree22fd59cdf41d7df66d3a28cb54ef2238c0091a41 /drivers/gpu/drm/panfrost/panfrost_mmu.c
parentdf5eff6d2a44c8f01b0dcd61b0ed5715116e10b4 (diff)
drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_addr()
Add the missing unlock before return from function panfrost_mmu_map_fault_addr() in the error handling case. Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190814044814.102294-1-weiyongjun1@huawei.com
Diffstat (limited to 'drivers/gpu/drm/panfrost/panfrost_mmu.c')
-rw-r--r--drivers/gpu/drm/panfrost/panfrost_mmu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 2ed411f09d80..06f1a563e940 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
if (!bo->base.pages) {
bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M,
sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO);
- if (!bo->sgts)
+ if (!bo->sgts) {
+ mutex_unlock(&bo->base.pages_lock);
return -ENOMEM;
+ }
pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT,
sizeof(struct page *), GFP_KERNEL | __GFP_ZERO);
if (!pages) {
kfree(bo->sgts);
bo->sgts = NULL;
+ mutex_unlock(&bo->base.pages_lock);
return -ENOMEM;
}
bo->base.pages = pages;