From 2741d43a1edd13c81a50ceb63f4edbf5fedb53ce Mon Sep 17 00:00:00 2001 From: "Subhransu S. Prusty" Date: Wed, 30 Jul 2014 18:39:05 +0530 Subject: [PATCH] ASoC: Intel: mfld-pcm: Allocate platform data Platform data may be null during platform_device_add. Allocate platform data before using. Signed-off-by: Subhransu S. Prusty Signed-off-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/intel/sst-mfld-platform-pcm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 47df05e..706212a 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -570,7 +570,7 @@ static int sst_platform_probe(struct platform_device *pdev) { struct sst_data *drv; int ret; - struct sst_platform_data *pdata = pdev->dev.platform_data; + struct sst_platform_data *pdata; drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); if (drv == NULL) { @@ -578,6 +578,12 @@ static int sst_platform_probe(struct platform_device *pdev) return -ENOMEM; } + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (pdata == NULL) { + pr_err("kzalloc failed for pdata\n"); + return -ENOMEM; + } + pdata->pdev_strm_map = dpcm_strm_map; pdata->strm_map_size = ARRAY_SIZE(dpcm_strm_map); drv->pdata = pdata; -- 2.7.4