media: venus: hfi: Correct session init return error
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Fri, 4 Dec 2020 10:01:39 +0000 (11:01 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 13 Jan 2021 08:08:18 +0000 (09:08 +0100)
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>
drivers/media/platform/qcom/venus/hfi.c
drivers/media/platform/qcom/venus/vdec.c
drivers/media/platform/qcom/venus/venc.c

index 8786609..0f24823 100644 (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);
index 4af14d8..5fe77a7 100644 (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;
index 700c045..8cc0695 100644 (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;