From: Stanimir Varbanov Date: Fri, 4 Dec 2020 10:01:39 +0000 (+0100) Subject: media: venus: hfi: Correct session init return error X-Git-Tag: v5.15~1736^2~211 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e922a33e0228fa314ffc4f70b3b9ffbc4aad1bbe;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 8786609d269e..0f2482367e06 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -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); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 4af14d8d92f6..5fe77a7d8139 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -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; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 700c045125b2..8cc0695df492 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -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;