Commit daa7031a authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Hans Verkuil
Browse files

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: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
parent df4ff474
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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:
+9 −9
Original line number Diff line number Diff line
@@ -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: