Commit 3efdf83c authored by Wei Yongjun's avatar Wei Yongjun Committed by Rob Herring

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: 187d2929 ("drm/panfrost: Add support for GPU heap allocations")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190814044814.102294-1-weiyongjun1@huawei.com
parent df5eff6d
...@@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr) ...@@ -327,14 +327,17 @@ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
if (!bo->base.pages) { if (!bo->base.pages) {
bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M, bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M,
sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO); sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO);
if (!bo->sgts) if (!bo->sgts) {
mutex_unlock(&bo->base.pages_lock);
return -ENOMEM; return -ENOMEM;
}
pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT,
sizeof(struct page *), GFP_KERNEL | __GFP_ZERO); sizeof(struct page *), GFP_KERNEL | __GFP_ZERO);
if (!pages) { if (!pages) {
kfree(bo->sgts); kfree(bo->sgts);
bo->sgts = NULL; bo->sgts = NULL;
mutex_unlock(&bo->base.pages_lock);
return -ENOMEM; return -ENOMEM;
} }
bo->base.pages = pages; bo->base.pages = pages;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment