From 6b9c2cd8cc4dfcfa73a8552c7a15de9e3f9a4b5d Mon Sep 17 00:00:00 2001 From: Ankur Pawar Date: Thu, 23 Mar 2023 12:13:00 +0000 Subject: [PATCH] camera: oot: unmap buf in non atomic context Call dma_buf_unmap_attachment from non atomic context. This will resolve the kernel BUG warning that appears when running argus tests, scf function tests and fusa capture tests. Bug 3953333 Change-Id: I9042b375856556fe5829981cb8aefd81e45b749b Signed-off-by: Ankur Pawar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2875756 Reviewed-by: svcacv Reviewed-by: Frank Chen Reviewed-by: Ajith Kumar Reviewed-by: Sudhir Vyas GVS: Gerrit_Virtual_Submit --- .../media/platform/tegra/camera/fusa-capture/capture-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c index e490bcab..8cbc0f9d 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c @@ -352,10 +352,11 @@ void destroy_buffer_table( if (unlikely(tab == NULL)) return; - write_lock(&tab->hlock); hash_for_each_safe(tab->hhead, bkt, next, pin, hnode) { + write_lock(&tab->hlock); hash_del(&pin->hnode); + write_unlock(&tab->hlock); dma_buf_unmap_attachment( pin->atch, pin->sgt, flag_dma_direction(pin->flag)); dma_buf_detach(pin->buf, pin->atch); @@ -363,7 +364,6 @@ void destroy_buffer_table( kmem_cache_free(tab->cache, pin); } - write_unlock(&tab->hlock); kmem_cache_destroy(tab->cache); kfree(tab);