media: venus: hfi: Correct session init return error

The hfi_session_init can be called many times and it returns
EINVAL when the session was already initialized. This error code
(EINVAL) is confusing for the callers. Change hfi_session_init to
return EALREADY error code when the session has been already
initialized.

Tested-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Stanimir Varbanov 2020-12-04 11:01:39 +01:00 committed by Mauro Carvalho Chehab
parent 7f339fdc37
commit e922a33e02
3 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt)
mutex_unlock(&core->lock);
if (inst->state != INST_UNINIT)
return -EINVAL;
return -EALREADY;
inst->hfi_codec = to_codec_type(pixfmt);
reinit_completion(&inst->done);

View File

@ -761,7 +761,7 @@ static int vdec_session_init(struct venus_inst *inst)
int ret;
ret = hfi_session_init(inst, inst->fmt_out->pixfmt);
if (ret == -EINVAL)
if (ret == -EALREADY)
return 0;
else if (ret)
return ret;

View File

@ -725,7 +725,7 @@ static int venc_init_session(struct venus_inst *inst)
int ret;
ret = hfi_session_init(inst, inst->fmt_cap->pixfmt);
if (ret == -EINVAL)
if (ret == -EALREADY)
return 0;
else if (ret)
return ret;