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

Commit 1dee6060 authored by Jilai Wang's avatar Jilai Wang
Browse files

msm: npu: replace EPERM with other error codes



This change is to replace EPERM with other meaningful error codes.

Change-Id: Icbe5b3aabe2e3fedc33893b77d8ef49ffadb3a2d
Signed-off-by: default avatarJilai Wang <jilaiw@codeaurora.org>
parent 553427bb
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ static int ipc_queue_read(struct npu_device *npu_dev,
		 */
		queue.qhdr_rx_req = 1;
		*is_tx_req_set = 0;
		status = -EPERM;
		status = -EIO;
		goto exit;
	}

@@ -232,12 +232,8 @@ static int ipc_queue_read(struct npu_device *npu_dev,
			target_que,
			packet_size);

	if (packet_size == 0) {
		status = -EPERM;
		goto exit;
	}

	if (packet_size > NPU_IPC_BUF_LENGTH) {
	if ((packet_size == 0) ||
		(packet_size > NPU_IPC_BUF_LENGTH)) {
		NPU_ERR("Invalid packet size %d\n", packet_size);
		status = -EINVAL;
		goto exit;
@@ -313,7 +309,7 @@ static int ipc_queue_write(struct npu_device *npu_dev,
	packet_size = (*(uint32_t *)packet);
	if (packet_size == 0) {
		/* assign failed status and return */
		status = -EPERM;
		status = -EINVAL;
		goto exit;
	}

+8 −9
Original line number Diff line number Diff line
@@ -154,11 +154,10 @@ static int load_fw_nolock(struct npu_device *npu_dev, bool enable)
	}

	/* Keep reading ctrl status until NPU is ready */
	if (wait_for_status_ready(npu_dev, REG_NPU_FW_CTRL_STATUS,
		FW_CTRL_STATUS_MAIN_THREAD_READY_VAL, false)) {
		ret = -EPERM;
	ret = wait_for_status_ready(npu_dev, REG_NPU_FW_CTRL_STATUS,
		FW_CTRL_STATUS_MAIN_THREAD_READY_VAL, false);
	if (ret)
		goto load_fw_fail;
	}

	npu_host_ipc_post_init(npu_dev);
	NPU_DBG("firmware init complete\n");
@@ -527,7 +526,7 @@ static int npu_notify_fw_pwr_state(struct npu_device *npu_dev,
			reg_val = REGR(npu_dev, REG_NPU_FW_CTRL_STATUS);
			if (reg_val & FW_CTRL_STATUS_PWR_NOTIFY_ERR_VAL) {
				NPU_ERR("NOTIfY_PWR failed\n");
				ret = -EPERM;
				ret = -EIO;
			}
		}
	}
@@ -691,7 +690,7 @@ int npu_host_init(struct npu_device *npu_dev)
	host_ctx->wq_pri =
		alloc_workqueue("npu_ipc_wq", WQ_HIGHPRI | WQ_UNBOUND, 0);
	if (!host_ctx->wq || !host_ctx->wq_pri) {
		ret = -EPERM;
		ret = -ENOMEM;
		goto fail;
	} else {
		INIT_WORK(&host_ctx->ipc_irq_work, npu_ipc_irq_work);
@@ -918,10 +917,10 @@ static int host_error_hdlr(struct npu_device *npu_dev, bool force)
	host_ctx->err_irq_sts = 0;

	/* Keep reading ctrl status until NPU is ready */
	if (wait_for_status_ready(npu_dev, REG_NPU_FW_CTRL_STATUS,
		FW_CTRL_STATUS_MAIN_THREAD_READY_VAL, false)) {
	ret = wait_for_status_ready(npu_dev, REG_NPU_FW_CTRL_STATUS,
		FW_CTRL_STATUS_MAIN_THREAD_READY_VAL, false);
	if (ret) {
		NPU_ERR("wait for fw status ready timedout\n");
		ret = -EPERM;
		goto fw_start_done;
	}