Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sound/soc/sof/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev)
if (ret < 0) {
dev_err(sdev->dev,
"error: failed to load route sink %s control %s source %s\n",
sroute->route->sink,
sroute->route->control ? sroute->route->control
sroute->route.sink,
sroute->route.control ? sroute->route.control
: "none",
sroute->route->source);
sroute->route.source);

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ struct snd_sof_widget {
struct snd_sof_route {
struct snd_sof_dev *sdev;

struct snd_soc_dapm_route *route;
struct snd_soc_dapm_route route;
struct list_head list; /* list in sdev route list */

void *private;
Expand Down
32 changes: 30 additions & 2 deletions sound/soc/sof/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,17 @@ static int spcm_bind(struct snd_soc_component *scomp, struct snd_sof_pcm *spcm,
return 0;
}

/* Used for free route in topology free stage */
static void sof_route_remove(struct snd_soc_dapm_route *route)
{
if (!route)
return;

kfree(route->source);
kfree(route->sink);
kfree(route->control);
}

/* DAI link - used for any driver specific init */
static int sof_route_load(struct snd_soc_component *scomp, int index,
struct snd_soc_dapm_route *route)
Expand Down Expand Up @@ -1999,7 +2010,22 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
goto err;
}

sroute->route = route;
sroute->route.source = kstrdup(route->source, GFP_KERNEL);
if (!sroute->route.source)
goto err;

sroute->route.sink = kstrdup(route->sink, GFP_KERNEL);
if (!sroute->route.sink) {
kfree(sroute->route.source);
goto err;
}

sroute->route.control = kstrdup(route->control, GFP_KERNEL);
if (!sroute->route.control) {
kfree(sroute->route.source);
kfree(sroute->route.sink);
goto err;
}
sroute->private = connect;

/* add route to route list */
Expand Down Expand Up @@ -2175,7 +2201,9 @@ void snd_sof_free_topology(struct snd_sof_dev *sdev)
list_for_each_entry_safe(sroute, temp, &sdev->route_list, list) {

/* delete dapm route */
snd_soc_dapm_del_routes(dapm, sroute->route, 1);
snd_soc_dapm_del_routes(dapm, &sroute->route, 1);

sof_route_remove(&sroute->route);

/* free sroute and its private data */
kfree(sroute->private);
Expand Down