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

Commit 68b09de0 authored by Jilai Wang's avatar Jilai Wang
Browse files

msm: npu: Limit one client to load network



This change is to limit only one client to be able to load network.

Change-Id: I081b068044e29c0198f46a62481e675abdf89dbe
Signed-off-by: default avatarJilai Wang <jilaiw@codeaurora.org>
parent 3335887c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -579,6 +579,17 @@ static struct npu_network *alloc_network(struct npu_host_ctx *ctx,

	WARN_ON(!mutex_is_locked(&ctx->lock));

	for (i = 0; i < MAX_LOADED_NETWORK; i++) {
		if ((network->id != 0) &&
			(network->client != client)) {
			pr_err("NPU is used by other client now\n");
			return NULL;
		}

		network++;
	}

	network = ctx->networks;
	for (i = 0; i < MAX_LOADED_NETWORK; i++) {
		if (network->id == 0)
			break;