Skip to content

Commit

Permalink
drm/panfrost: Fix missing unlock on error in panfrost_mmu_map_fault_a…
Browse files Browse the repository at this point in the history
…ddr()

Add the missing unlock before return from function panfrost_mmu_map_fault_addr()
in the error handling case.

Fixes: 187d292 ("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
  • Loading branch information
Wei Yongjun authored and Rob Herring committed Aug 19, 2019
1 parent df5eff6 commit 3efdf83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/panfrost/panfrost_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3efdf83

Please sign in to comment.