msm: cvp: Avoid sending DSP HFI buf twice

Second buffer sending may crash DSP.

Change-Id: I67b4d293aa4a41ea40f30744ae79d0a5a66fa017
Signed-off-by: George Shen <sqiao@codeaurora.org>
This commit is contained in:
George Shen 2020-05-15 15:48:02 -07:00
commit 54d791bc29

View file

@ -153,10 +153,9 @@ static int cvp_dsp_rpmsg_probe(struct rpmsg_device *rpdev)
mutex_lock(&me->lock);
me->chan = rpdev;
me->state = DSP_PROBED;
complete(&me->completions[CPU2DSP_MAX_CMD]);
mutex_unlock(&me->lock);
cvp_dsp_send_hfi_queue();
return 0;
}
@ -490,6 +489,14 @@ wait_dsp:
if (me->state == DSP_INVALID)
goto exit;
if (me->state == DSP_UNINIT)
goto wait_dsp;
if (me->state == DSP_PROBED) {
cvp_dsp_send_hfi_queue();
goto wait_dsp;
}
cmd.type = me->pending_dsp2cpu_cmd.type;
if (rc == -ERESTARTSYS) {
@ -569,13 +576,14 @@ int cvp_dsp_device_init(void)
goto register_bail;
}
snprintf(tname, sizeof(tname), "cvp-dsp-thread");
me->state = DSP_UNINIT;
me->dsp_thread = kthread_run(cvp_dsp_thread, me, tname);
if (!me->dsp_thread) {
dprintk(CVP_ERR, "%s create %s fail", __func__, tname);
rc = -ECHILD;
me->state = DSP_INVALID;
goto register_bail;
}
me->state = DSP_UNINIT;
return 0;
register_bail: