diff options
author | Dave Airlie <airlied@redhat.com> | 2023-10-20 06:23:25 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2023-10-20 06:24:35 +0200 |
commit | 8b35ce3f7a9699e7580527fe4510d77f2a35f02d (patch) | |
tree | 63b47e7ac19ce67b12549423ed3a5e30651a21d6 /drivers/gpu | |
parent | Merge tag 'drm-intel-fixes-2023-10-19' of git://anongit.freedesktop.org/drm/d... (diff) | |
parent | drm/mediatek: Correctly free sg_table in gem prime vmap (diff) | |
download | linux-8b35ce3f7a9699e7580527fe4510d77f2a35f02d.tar.xz linux-8b35ce3f7a9699e7580527fe4510d77f2a35f02d.zip |
Merge tag 'mediatek-drm-fixes-20231017' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes
Mediatek DRM Fixes - 20231017
1. Correctly free sg_table in gem prime vmap
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231016233659.3639-1-chunkuang.hu@kernel.org
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_gem.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c index 9f364df52478..0e0a41b2f57f 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c @@ -239,6 +239,7 @@ int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map) npages = obj->size >> PAGE_SHIFT; mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL); if (!mtk_gem->pages) { + sg_free_table(sgt); kfree(sgt); return -ENOMEM; } @@ -248,12 +249,15 @@ int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map) mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP, pgprot_writecombine(PAGE_KERNEL)); if (!mtk_gem->kvaddr) { + sg_free_table(sgt); kfree(sgt); kfree(mtk_gem->pages); return -ENOMEM; } -out: + sg_free_table(sgt); kfree(sgt); + +out: iosys_map_set_vaddr(map, mtk_gem->kvaddr); return 0; |