msm: vidc: Fail qbuf and prepare_buf incase of error

If either instance state or core state is invalid, then
we should fail and return error from qbuf and prepare_buf.

CRs-Fixed: 1072500

Change-Id: I0efc3125b2c204dafbc90d011a4e9ad3fb1c1ba2
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
This commit is contained in:
Maheshwar Ajja 2016-04-22 16:57:59 -07:00
parent e2787f510d
commit e4798a5564

View file

@ -685,7 +685,11 @@ int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b)
{
struct msm_vidc_inst *inst = instance;
if (!inst || !b || !valid_v4l2_buffer(b, inst))
if (!inst || !inst->core || !b || !valid_v4l2_buffer(b, inst))
return -EINVAL;
if (inst->state == MSM_VIDC_CORE_INVALID ||
inst->core->state == VIDC_CORE_INVALID)
return -EINVAL;
if (is_dynamic_output_buffer_mode(b, inst))
@ -807,7 +811,11 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
int rc = 0;
int i;
if (!inst || !b || !valid_v4l2_buffer(b, inst))
if (!inst || !inst->core || !b || !valid_v4l2_buffer(b, inst))
return -EINVAL;
if (inst->state == MSM_VIDC_CORE_INVALID ||
inst->core->state == VIDC_CORE_INVALID)
return -EINVAL;
rc = map_and_register_buf(inst, b);