summaryrefslogtreecommitdiff
path: root/sound/soc/ux500
diff options
context:
space:
mode:
authorRajan Vaja <rajan.vaja@gmail.com>2015-05-20 10:20:54 +0530
committerMark Brown <broonie@kernel.org>2015-05-21 12:05:48 +0100
commit72f0095e7993dd9af8d5531740bf549359314bf0 (patch)
treed3499d3a2e8e0e2058e8473059e3449419d15a7e /sound/soc/ux500
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
ASoC: mop500_ab8500: Add a NULL pointer check in mop500_ab8500_machine_init()
Avoid possible crash (NULL pointer dereference) by making sure that dem_kzalloc() is successful. Signed-off-by: Rajan Vaja <rajan.vaja@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r--sound/soc/ux500/mop500_ab8500.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c
index b81a7a4c938b..85d810d7667c 100644
--- a/sound/soc/ux500/mop500_ab8500.c
+++ b/sound/soc/ux500/mop500_ab8500.c
@@ -372,6 +372,10 @@ int mop500_ab8500_machine_init(struct snd_soc_pcm_runtime *rtd)
/* Create driver private-data struct */
drvdata = devm_kzalloc(dev, sizeof(struct mop500_ab8500_drvdata),
GFP_KERNEL);
+
+ if (!drvdata)
+ return -ENOMEM;
+
snd_soc_card_set_drvdata(rtd->card, drvdata);
/* Setup clocks */