[alsa-devel] [PATCH 3/4] ASoC: pcm3008: Check for platform data

Mark Brown broonie at kernel.org
Wed Jul 10 17:54:59 CEST 2013


From: Mark Brown <broonie at linaro.org>

The driver will crash if none is provided.

Signed-off-by: Mark Brown <broonie at linaro.org>
---
 sound/soc/codecs/pcm3008.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c
index 8ab1c03..4fa4ded 100644
--- a/sound/soc/codecs/pcm3008.c
+++ b/sound/soc/codecs/pcm3008.c
@@ -92,6 +92,9 @@ static int pcm3008_codec_probe(struct platform_device *pdev)
 	struct pcm3008_setup_data *setup = pdev->dev.platform_data;
 	int ret;
 
+	if (!setup)
+		return -EINVAL;
+
 	/* DEM1  DEM0  DE-EMPHASIS_MODE
 	 * Low   Low   De-emphasis 44.1 kHz ON
 	 * Low   High  De-emphasis OFF
-- 
1.8.3.2



More information about the Alsa-devel mailing list