diff mbox

[1/2] ASoC: Samsung: return error if drvdata is not set

Message ID 1364901782-16619-1-git-send-email-padma.v@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Padmavathi Venna April 2, 2013, 11:23 a.m. UTC
From: Prathyush K <prathyush.k@samsung.com>

This patch fixes a possible crash in case drvdata for the secondary
device is not set.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---

Based on Kukjin for-next branch

 sound/soc/samsung/i2s.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Mark Brown April 3, 2013, 4:57 p.m. UTC | #1
On Tue, Apr 02, 2013 at 04:53:01PM +0530, Padmavathi Venna wrote:
> From: Prathyush K <prathyush.k@samsung.com>
> 
> This patch fixes a possible crash in case drvdata for the secondary
> device is not set.

Applied both, thanks.
diff mbox

Patch

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d7231e3..f1fc064 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1107,6 +1107,10 @@  static int samsung_i2s_probe(struct platform_device *pdev)
 
 	if (samsung_dai_type == TYPE_SEC) {
 		sec_dai = dev_get_drvdata(&pdev->dev);
+		if (!sec_dai) {
+			dev_err(&pdev->dev, "Unable to get drvdata\n");
+			return -EFAULT;
+		}
 		snd_soc_register_dai(&sec_dai->pdev->dev,
 			&sec_dai->i2s_dai_drv);
 		asoc_dma_platform_register(&pdev->dev);