]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: venus: hfi: return an error if session_init is already called
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Wed, 16 Jan 2019 13:41:14 +0000 (11:41 -0200)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 5 Aug 2019 13:51:28 +0000 (10:51 -0300)
This makes hfi_session_init to return an error when it is
already called without a call to hfi_session_deinit.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/qcom/venus/hfi.c

index 82eb889ab5414f19c282953e16eef5d1dd16c85f..3d8b1284d1f35386b598f2c41deff1fd1e572b98 100644 (file)
@@ -198,6 +198,9 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt)
        const struct hfi_ops *ops = core->ops;
        int ret;
 
+       if (inst->state != INST_UNINIT)
+               return -EINVAL;
+
        inst->hfi_codec = to_codec_type(pixfmt);
        reinit_completion(&inst->done);