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@xxxxxxx> --- sound/soc/amd/acp/acp-pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index ad320b29e87d..aa3e72d13451 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -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; } -- 2.34.1
- Follow-Ups:
- Re: (subset) [PATCH 1/8] ASoC: amd: acp: add a null check for chip_pdev structure
- From: Mark Brown
- Re: (subset) [PATCH 1/8] ASoC: amd: acp: add a null check for chip_pdev structure
- From: Mark Brown
- [PATCH 8/8] ASoC: amd: acp: add pcm constraints for buffer size and period size
- From: Vijendar Mukunda
- [PATCH 7/8] ASoC: amd: acp: move i2s clock generation sequence
- From: Vijendar Mukunda
- [PATCH 6/8] ASoC: amd: acp: modify conditional check for programming i2s mclk
- From: Vijendar Mukunda
- [PATCH 5/8] ASoC: amd: acp: remove unused variables from acp_resource structure
- From: Vijendar Mukunda
- [PATCH 4/8] ASoC: amd: acp: remove acp_i2s_probe function
- From: Vijendar Mukunda
- [PATCH 3/8] ASoC: amd: acp: move chip->flag variable assignment
- From: Vijendar Mukunda
- [PATCH 2/8] ASoC: amd: acp: remove i2s configuration check in acp_i2s_probe()
- From: Vijendar Mukunda
- Re: (subset) [PATCH 1/8] ASoC: amd: acp: add a null check for chip_pdev structure
- Prev by Date: [PATCH v2] ASoC: fsl: imx-pcm-fiq: add missing MODULE_DESCRIPTION() macro
- Next by Date: [PATCH 2/8] ASoC: amd: acp: remove i2s configuration check in acp_i2s_probe()
- Previous by thread: [PATCH v2] ASoC: fsl: imx-pcm-fiq: add missing MODULE_DESCRIPTION() macro
- Next by thread: [PATCH 2/8] ASoC: amd: acp: remove i2s configuration check in acp_i2s_probe()
- Index(es):