Skip to content

Commit 8b35ce3

Browse files
committed
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 <[email protected]> From: Chun-Kuang Hu <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 280bd84 + dcc583c commit 8b35ce3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/mediatek/mtk_drm_gem.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map)
239239
npages = obj->size >> PAGE_SHIFT;
240240
mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
241241
if (!mtk_gem->pages) {
242+
sg_free_table(sgt);
242243
kfree(sgt);
243244
return -ENOMEM;
244245
}
@@ -248,12 +249,15 @@ int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map)
248249
mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP,
249250
pgprot_writecombine(PAGE_KERNEL));
250251
if (!mtk_gem->kvaddr) {
252+
sg_free_table(sgt);
251253
kfree(sgt);
252254
kfree(mtk_gem->pages);
253255
return -ENOMEM;
254256
}
255-
out:
257+
sg_free_table(sgt);
256258
kfree(sgt);
259+
260+
out:
257261
iosys_map_set_vaddr(map, mtk_gem->kvaddr);
258262

259263
return 0;

0 commit comments

Comments
 (0)