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

Commit 8467c72f authored by Mao Jinlong's avatar Mao Jinlong Committed by Gerrit - the friendly Code Review server
Browse files

coresight: Delete path from active paths when exception happens



The path will be released when fail to enable any sink or link. The
path must be deleted from active paths before release it. Otherwise
it will get invalid address of path when enable or disable the paths.

Change-Id: Id37fdbc3854bae414f043bd049bc6af2e90af5fa
Signed-off-by: default avatarMao Jinlong <jinlmao@codeaurora.org>
parent ba6dd9aa
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -905,7 +905,7 @@ static int coresight_store_path(struct list_head *path)
	return 0;
}

static void coresight_enable_source_link(struct list_head *path)
static int coresight_enable_source_link(struct list_head *path)
{
	u32 type;
	int ret;
@@ -951,10 +951,10 @@ static void coresight_enable_source_link(struct list_head *path)
		}
	}

	return;
	return 0;
err:
	coresight_disable_path_from(path, nd);
	coresight_release_path(path);
	return ret;
}

static void coresight_disable_source_link(struct list_head *path)
@@ -1012,13 +1012,22 @@ void coresight_disable_all_source_link(void)

void coresight_enable_all_source_link(void)
{
	struct list_head *path = NULL;
	struct coresight_path *cspath = NULL;
	struct coresight_path *cspath_next = NULL;
	int ret;


	mutex_lock(&coresight_mutex);

	list_for_each_entry_safe(cspath, cspath_next, &cs_active_paths, link) {
		coresight_enable_source_link(cspath->path);
		ret = coresight_enable_source_link(cspath->path);
		if (ret) {
			path = cspath->path;
			list_del(&cspath->link);
			kfree(cspath);
			coresight_release_path(path);
		}
	}

	if (activated_sink && activated_sink->enable)