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: Mao Jinlong <jinlmao@codeaurora.org>
This commit is contained in:
Mao Jinlong 2020-07-14 22:24:40 +08:00 • committed by Gerrit - the friendly Code Review server
commit 8467c72f2f

View file

@ -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)