Skip to content

Commit

Permalink
ASoC: mop500_ab8500: Add a NULL pointer check in mop500_ab8500_machin…
Browse files Browse the repository at this point in the history
…e_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>
  • Loading branch information
Rajan Vaja authored and Mark Brown committed May 21, 2015
1 parent b787f68 commit 72f0095
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sound/soc/ux500/mop500_ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 72f0095

Please sign in to comment.