OSDN Git Service

ASoC: AMD: Add NULL pointer check
authorAgrawal, Akshu <Akshu.Agrawal@amd.com>
Thu, 7 Jun 2018 06:48:43 +0000 (14:48 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 18 Jun 2018 11:33:08 +0000 (12:33 +0100)
Fix crash in those platforms whose machine driver does not expose
platform_info. For those platforms we rely on default value and
select I2SSP channel.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/acp-pcm-dma.c

index 7720384..1458b50 100644 (file)
@@ -773,7 +773,8 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream,
        if (WARN_ON(!rtd))
                return -EINVAL;
 
-       rtd->i2s_instance = pinfo->i2s_instance;
+       if (pinfo)
+               rtd->i2s_instance = pinfo->i2s_instance;
        if (adata->asic_type == CHIP_STONEY) {
                val = acp_reg_read(adata->acp_mmio,
                                   mmACP_I2S_16BIT_RESOLUTION_EN);