Skip to content

Commit

Permalink
ASoC: amd: acp: add a null check for chip_pdev structure
Browse files Browse the repository at this point in the history
When acp platform device creation is skipped, chip->chip_pdev value will
remain NULL. Add NULL check for chip->chip_pdev structure in
snd_acp_resume() function to avoid null pointer dereference.

Fixes: 088a409 ("ASoC: amd: acp: add pm ops support for acp pci driver")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240617072844.871468-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
vijendarmukunda authored and broonie committed Jun 19, 2024
1 parent 60ff540 commit 98d919d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sound/soc/amd/acp/acp-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ static int __maybe_unused snd_acp_resume(struct device *dev)
ret = acp_init(chip);
if (ret)
dev_err(dev, "ACP init failed\n");
child = chip->chip_pdev->dev;
adata = dev_get_drvdata(&child);
if (adata)
acp_enable_interrupts(adata);
if (chip->chip_pdev) {
child = chip->chip_pdev->dev;
adata = dev_get_drvdata(&child);
if (adata)
acp_enable_interrupts(adata);
}
return ret;
}

Expand Down

0 comments on commit 98d919d

Please sign in to comment.