mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
ASoC: tegra: fix crash in machine driver.
DAI link structure has changed in 5.4 and memory needs to be allocated for DAI link cpu/codec/platform components. The same is done with the current patch to avoid the crash. Bug 2845498 Change-Id: I2d69517120b6debbd0bb8d6a51ab9c5f6d47a401 Signed-off-by: Sameer Pujar <spujar@nvidia.com>
This commit is contained in:
@@ -306,7 +306,7 @@ static int parse_dt_dai_links(struct snd_soc_card *card,
|
||||
struct device_node *top = pdev->dev.of_node;
|
||||
struct device_node *link_node;
|
||||
struct snd_soc_dai_link *dai_links;
|
||||
unsigned int num_links, link_count = 0;
|
||||
unsigned int num_links, link_count = 0, i;
|
||||
int ret;
|
||||
|
||||
ret = get_num_dai_links(pdev, &machine->asoc->num_links);
|
||||
@@ -322,6 +322,30 @@ static int parse_dt_dai_links(struct snd_soc_card *card,
|
||||
if (!dai_links)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < num_links; i++) {
|
||||
dai_links[i].cpus = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*dai_links[i].cpus),
|
||||
GFP_KERNEL);
|
||||
if (!dai_links[i].cpus)
|
||||
return -ENOMEM;
|
||||
|
||||
dai_links[i].codecs = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*dai_links[i].codecs),
|
||||
GFP_KERNEL);
|
||||
if (!dai_links[i].codecs)
|
||||
return -ENOMEM;
|
||||
|
||||
dai_links[i].platforms = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*dai_links[i].platforms),
|
||||
GFP_KERNEL);
|
||||
if (!dai_links[i].platforms)
|
||||
return -ENOMEM;
|
||||
|
||||
dai_links[i].num_cpus = 1;
|
||||
dai_links[i].num_codecs = 1;
|
||||
dai_links[i].num_platforms = 1;
|
||||
}
|
||||
|
||||
machine->asoc->dai_links = dai_links;
|
||||
|
||||
link_node = of_get_child_by_name(top, PREFIX "dai-link");
|
||||
|
||||
Reference in New Issue
Block a user