Skip to content

Commit b6b5c64

Browse files
vijendarmukundabroonie
authored andcommitted
ASoC: amd: ps: fix for acp_lock access in pdm driver
Sending the mutex address(acp_lock) as platform data during ACP PDM platform driver register sequence, its creating copy of the platform data. Referencing this platform data in ACP PDM driver results incorrect reference to the common lock usage. Instead of directly passing the lock address as platform data, retrieve it from parent driver data structure and use the same lock reference in ACP PDM driver. Fixes: 45aa83c ("ASoC: amd: ps: use acp_lock to protect common registers in pdm driver") Signed-off-by: Vijendar Mukunda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8938f75 commit b6b5c64

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sound/soc/amd/ps/pci-ps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
211211
case ACP63_PDM_DEV_MASK:
212212
adata->pdm_dev_index = 0;
213213
acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma",
214-
0, adata->res, 1, &adata->acp_lock,
215-
sizeof(adata->acp_lock));
214+
0, adata->res, 1, NULL, 0);
216215
acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec",
217216
0, NULL, 0, NULL, 0);
218217
acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach",

sound/soc/amd/ps/ps-pdm-dma.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
361361
{
362362
struct resource *res;
363363
struct pdm_dev_data *adata;
364+
struct acp63_dev_data *acp_data;
365+
struct device *parent;
364366
int status;
365367

366-
if (!pdev->dev.platform_data) {
367-
dev_err(&pdev->dev, "platform_data not retrieved\n");
368-
return -ENODEV;
369-
}
368+
parent = pdev->dev.parent;
369+
acp_data = dev_get_drvdata(parent);
370370
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
371371
if (!res) {
372372
dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
@@ -382,7 +382,7 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
382382
return -ENOMEM;
383383

384384
adata->capture_stream = NULL;
385-
adata->acp_lock = pdev->dev.platform_data;
385+
adata->acp_lock = &acp_data->acp_lock;
386386
dev_set_drvdata(&pdev->dev, adata);
387387
status = devm_snd_soc_register_component(&pdev->dev,
388388
&acp63_pdm_component,

0 commit comments

Comments
 (0)