Skip to content

Commit 272ee03

Browse files
Peter Ujfalusibroonie
authored andcommitted
ASoC: davinci-mcasp: Use a copy of pdata per instance during DT boot
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 <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 9ac0013 commit 272ee03

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sound/soc/davinci/davinci-mcasp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,14 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
15991599
pdata = pdev->dev.platform_data;
16001600
return pdata;
16011601
} else if (match) {
1602-
pdata = (struct davinci_mcasp_pdata*) match->data;
1602+
pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata),
1603+
GFP_KERNEL);
1604+
if (!pdata) {
1605+
dev_err(&pdev->dev,
1606+
"Failed to allocate memory for pdata\n");
1607+
ret = -ENOMEM;
1608+
return pdata;
1609+
}
16031610
} else {
16041611
/* control shouldn't reach here. something is wrong */
16051612
ret = -EINVAL;

0 commit comments

Comments
 (0)