summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>2024-06-17 10:28:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-05 10:33:46 +0300
commite158ed266fc1adfa456880fb6dabce2e5623843b (patch)
tree3ce7923c66c6ad9d2e50d917b1d0f3ed63d7d387
parent05cbeb0803ef9ef8ebd5e4361942eb9336a0e8c4 (diff)
downloadlinux-e158ed266fc1adfa456880fb6dabce2e5623843b.tar.xz
ASoC: amd: acp: add a null check for chip_pdev structure
[ Upstream commit 98d919dfee1cc402ca29d45da642852d7c9a2301 ] 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: 088a40980efb ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--sound/soc/amd/acp/acp-pci.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
index 223238f662f8..7de6446e6f7c 100644
--- a/sound/soc/amd/acp/acp-pci.c
+++ b/sound/soc/amd/acp/acp-pci.c
@@ -185,10 +185,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;
}