Skip to content
Merged
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
19 changes: 10 additions & 9 deletions sound/soc/sof/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -2208,14 +2208,15 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
int ret = 0;

/* allocate memory for sroute and connect */
sroute = devm_kzalloc(sdev->dev, sizeof(*sroute), GFP_KERNEL);
sroute = kzalloc(sizeof(*sroute), GFP_KERNEL);
if (!sroute)
return -ENOMEM;

sroute->sdev = sdev;

connect = devm_kzalloc(sdev->dev, sizeof(*connect), GFP_KERNEL);
connect = kzalloc(sizeof(*connect), GFP_KERNEL);
if (!connect) {
kfree(sroute);
return -ENOMEM;
}

Expand All @@ -2233,9 +2234,7 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
spcm = snd_sof_find_spcm_name(sdev, (char *)route->source);
if (spcm) {
ret = spcm_bind(scomp, spcm, route->sink);
if (ret < 0)
goto err;
return 0;
goto err;
}

dev_err(sdev->dev, "error: source %s not found\n",
Expand All @@ -2253,9 +2252,7 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
spcm = snd_sof_find_spcm_name(sdev, (char *)route->sink);
if (spcm) {
ret = spcm_bind(scomp, spcm, route->source);
if (ret < 0)
goto err;
return 0;
goto err;
}

dev_err(sdev->dev, "error: sink %s not found\n",
Expand Down Expand Up @@ -2326,9 +2323,13 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,

/* add route to route list */
list_add(&sroute->list, &sdev->route_list);

return ret;
}

err:
kfree(connect);
kfree(sroute);
return ret;
}

Expand Down Expand Up @@ -2499,7 +2500,7 @@ void snd_sof_free_topology(struct snd_sof_dev *sdev)

/* free sroute and its private data */
kfree(sroute->private);
devm_kfree(sdev->dev, sroute);
kfree(sroute);
}

ret = snd_soc_tplg_component_remove(sdev->component,
Expand Down