summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSergey Senozhatsky <senozhatsky@chromium.org>2024-10-25 18:56:41 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2024-11-07 11:43:31 +0100
commit6c9934c5a00ae722a98d1a06ed44b673514407b5 (patch)
tree81341caf647d1c8ebb82b20996e3d290750d2046 /drivers/media
parentmedia: venus: Enable h.264 hierarchical coding (diff)
downloadlinux-6c9934c5a00ae722a98d1a06ed44b673514407b5.tar.xz
linux-6c9934c5a00ae722a98d1a06ed44b673514407b5.zip
media: venus: fix enc/dec destruction order
We destroy mutex-es too early as they are still taken in v4l2_fh_exit()->v4l2_event_unsubscribe()->v4l2_ctrl_find(). We should destroy mutex-es right before kfree(). Also do not vdec_ctrl_deinit() before v4l2_fh_exit(). Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files") Suggested-by: Tomasz Figa <tfiga@google.com> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/qcom/venus/vdec.c7
-rw-r--r--drivers/media/platform/qcom/venus/venc.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index fd4c4934c910..b81439d34d90 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -1750,13 +1750,14 @@ static int vdec_close(struct file *file)
cancel_work_sync(&inst->delayed_process_work);
v4l2_m2m_ctx_release(inst->m2m_ctx);
v4l2_m2m_release(inst->m2m_dev);
- vdec_ctrl_deinit(inst);
ida_destroy(&inst->dpb_ids);
hfi_session_destroy(inst);
- mutex_destroy(&inst->lock);
- mutex_destroy(&inst->ctx_q_lock);
v4l2_fh_del(&inst->fh);
v4l2_fh_exit(&inst->fh);
+ vdec_ctrl_deinit(inst);
+
+ mutex_destroy(&inst->lock);
+ mutex_destroy(&inst->ctx_q_lock);
vdec_pm_put(inst, false);
diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 61630a53bf68..efe1e3837fe8 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1542,14 +1542,14 @@ static int venc_close(struct file *file)
v4l2_m2m_ctx_release(inst->m2m_ctx);
v4l2_m2m_release(inst->m2m_dev);
- venc_ctrl_deinit(inst);
hfi_session_destroy(inst);
- mutex_destroy(&inst->lock);
- mutex_destroy(&inst->ctx_q_lock);
v4l2_fh_del(&inst->fh);
v4l2_fh_exit(&inst->fh);
+ venc_ctrl_deinit(inst);
inst->enc_state = VENUS_ENC_STATE_DEINIT;
+ mutex_destroy(&inst->lock);
+ mutex_destroy(&inst->ctx_q_lock);
venc_pm_put(inst, false);