Skip to content

Commit

Permalink
ASoC: davinci-mcasp: Use a copy of pdata per instance during DT boot
Browse files Browse the repository at this point in the history
Instead of modifying the static pdata struct per McASP instance we need to
allocate pdata for each McASP.
This way we can avoid configuration leakage from prior McASP to McASP
drivers probed at later time.

Reported-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Jun 2, 2016
1 parent 9ac0013 commit 272ee03
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sound/soc/davinci/davinci-mcasp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,14 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
pdata = pdev->dev.platform_data;
return pdata;
} else if (match) {
pdata = (struct davinci_mcasp_pdata*) match->data;
pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata),
GFP_KERNEL);
if (!pdata) {
dev_err(&pdev->dev,
"Failed to allocate memory for pdata\n");
ret = -ENOMEM;
return pdata;
}
} else {
/* control shouldn't reach here. something is wrong */
ret = -EINVAL;
Expand Down

0 comments on commit 272ee03

Please sign in to comment.