Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54d791bc authored by George Shen's avatar George Shen
Browse files

msm: cvp: Avoid sending DSP HFI buf twice



Second buffer sending may crash DSP.

Change-Id: I67b4d293aa4a41ea40f30744ae79d0a5a66fa017
Signed-off-by: default avatarGeorge Shen <sqiao@codeaurora.org>
parent 4fbfcf83
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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 @@ static int cvp_dsp_thread(void *data)
	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: