mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-21 23:29:26 -05:00
media: venus: match instance creation and destruction order
Match order of instances' initialization in venc_open()/vdec_close() and order of destruction in venus_common_close(). Suggested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
committed by
Hans Verkuil
parent
df4ff47448
commit
daa7031a31
@@ -1697,10 +1697,6 @@ static int vdec_open(struct file *file)
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
ret = hfi_session_create(inst, &vdec_hfi_ops);
|
||||
if (ret)
|
||||
goto err_ctrl_deinit;
|
||||
|
||||
vdec_inst_init(inst);
|
||||
|
||||
ida_init(&inst->dpb_ids);
|
||||
@@ -1712,15 +1708,19 @@ static int vdec_open(struct file *file)
|
||||
inst->m2m_dev = v4l2_m2m_init(&vdec_m2m_ops);
|
||||
if (IS_ERR(inst->m2m_dev)) {
|
||||
ret = PTR_ERR(inst->m2m_dev);
|
||||
goto err_session_destroy;
|
||||
goto err_ctrl_deinit;
|
||||
}
|
||||
|
||||
inst->m2m_ctx = v4l2_m2m_ctx_init(inst->m2m_dev, inst, m2m_queue_init);
|
||||
if (IS_ERR(inst->m2m_ctx)) {
|
||||
ret = PTR_ERR(inst->m2m_ctx);
|
||||
goto err_m2m_release;
|
||||
goto err_m2m_dev_release;
|
||||
}
|
||||
|
||||
ret = hfi_session_create(inst, &vdec_hfi_ops);
|
||||
if (ret)
|
||||
goto err_m2m_ctx_release;
|
||||
|
||||
v4l2_fh_init(&inst->fh, core->vdev_dec);
|
||||
|
||||
inst->fh.ctrl_handler = &inst->ctrl_handler;
|
||||
@@ -1730,10 +1730,10 @@ static int vdec_open(struct file *file)
|
||||
|
||||
return 0;
|
||||
|
||||
err_m2m_release:
|
||||
err_m2m_ctx_release:
|
||||
v4l2_m2m_ctx_release(inst->m2m_ctx);
|
||||
err_m2m_dev_release:
|
||||
v4l2_m2m_release(inst->m2m_dev);
|
||||
err_session_destroy:
|
||||
hfi_session_destroy(inst);
|
||||
err_ctrl_deinit:
|
||||
v4l2_ctrl_handler_free(&inst->ctrl_handler);
|
||||
err_free:
|
||||
|
||||
@@ -1492,10 +1492,6 @@ static int venc_open(struct file *file)
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
ret = hfi_session_create(inst, &venc_hfi_ops);
|
||||
if (ret)
|
||||
goto err_ctrl_deinit;
|
||||
|
||||
venc_inst_init(inst);
|
||||
|
||||
/*
|
||||
@@ -1505,15 +1501,19 @@ static int venc_open(struct file *file)
|
||||
inst->m2m_dev = v4l2_m2m_init(&venc_m2m_ops);
|
||||
if (IS_ERR(inst->m2m_dev)) {
|
||||
ret = PTR_ERR(inst->m2m_dev);
|
||||
goto err_session_destroy;
|
||||
goto err_ctrl_deinit;
|
||||
}
|
||||
|
||||
inst->m2m_ctx = v4l2_m2m_ctx_init(inst->m2m_dev, inst, m2m_queue_init);
|
||||
if (IS_ERR(inst->m2m_ctx)) {
|
||||
ret = PTR_ERR(inst->m2m_ctx);
|
||||
goto err_m2m_release;
|
||||
goto err_m2m_dev_release;
|
||||
}
|
||||
|
||||
ret = hfi_session_create(inst, &venc_hfi_ops);
|
||||
if (ret)
|
||||
goto err_m2m_ctx_release;
|
||||
|
||||
v4l2_fh_init(&inst->fh, core->vdev_enc);
|
||||
|
||||
inst->fh.ctrl_handler = &inst->ctrl_handler;
|
||||
@@ -1523,10 +1523,10 @@ static int venc_open(struct file *file)
|
||||
|
||||
return 0;
|
||||
|
||||
err_m2m_release:
|
||||
err_m2m_ctx_release:
|
||||
v4l2_m2m_ctx_release(inst->m2m_ctx);
|
||||
err_m2m_dev_release:
|
||||
v4l2_m2m_release(inst->m2m_dev);
|
||||
err_session_destroy:
|
||||
hfi_session_destroy(inst);
|
||||
err_ctrl_deinit:
|
||||
v4l2_ctrl_handler_free(&inst->ctrl_handler);
|
||||
err_free:
|
||||
|
||||
Reference in New Issue
Block a user