All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: mfld-pcm: Allocate platform data
@ 2014-07-30 13:09 Subhransu S. Prusty
  2014-07-31 19:19 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Subhransu S. Prusty @ 2014-07-30 13:09 UTC (permalink / raw)
  To: alsa-devel
  Cc: vinod.koul, broonie, Subhransu S. Prusty, lgirdwood, Lars-Peter Clausen

Platform data may be null during platform_device_add. Allocate platform
data before using.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 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 dbff2965a6e3..8dd1c0f6773f 100644
--- a/sound/soc/intel/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/sst-mfld-platform-pcm.c
@@ -694,7 +694,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) {
@@ -702,6 +702,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;
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: Intel: mfld-pcm: Allocate platform data
  2014-07-30 13:09 [PATCH] ASoC: Intel: mfld-pcm: Allocate platform data Subhransu S. Prusty
@ 2014-07-31 19:19 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-07-31 19:19 UTC (permalink / raw)
  To: Subhransu S. Prusty; +Cc: vinod.koul, alsa-devel, Lars-Peter Clausen, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 310 bytes --]

On Wed, Jul 30, 2014 at 06:39:05PM +0530, Subhransu S. Prusty wrote:
> Platform data may be null during platform_device_add. Allocate platform
> data before using.

Applied, thanks.  Looking at the change I hope that "may" should be
"will" - this will unconditionally overwrite any platform data that's
there.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-31 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-30 13:09 [PATCH] ASoC: Intel: mfld-pcm: Allocate platform data Subhransu S. Prusty
2014-07-31 19:19 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.